]>
Commit | Line | Data |
---|---|---|
a42f24b8 | 1 | # purs-loader |
2 | ||
08b34471 | 3 | > [PureScript](http://www.purescript.org) loader for [webpack](http://webpack.github.io) |
a42f24b8 | 4 | |
5 | ## Install | |
6 | ||
63d6a244 | 7 | Install with [npm](https://npmjs.org/package/purs-loader). |
8 | ||
9 | This loader works in conjunction with the [PureScript webpack plugin](https://npmjs.org/package/purescript-webpack-plugin). Ensure the plugin is installed and configured accordingly. | |
a42f24b8 | 10 | |
11 | ``` | |
12 | npm install purs-loader --save-dev | |
13 | ``` | |
14 | ||
15 | ## Options | |
16 | ||
d7811214 | 17 | ###### `bundleOutput` (String) |
a72c8af1 | 18 | |
63d6a244 | 19 | Relative path to the bundled JavaScript file generated by the `PurescriptWebpackPlugin`. The default value is `output/bundle.js`. |
a42f24b8 | 20 | |
21 | ## Example | |
22 | ||
1983893b | 23 | ```js |
24 | // webpack.config.js | |
63d6a244 | 25 | 'use strict'; |
1983893b | 26 | |
63d6a244 | 27 | var PurescriptWebpackPlugin = require('purescript-webpack-plugin'); |
1983893b | 28 | |
63d6a244 | 29 | var src = ['bower_components/purescript-*/src/**/*.purs', 'src/**/*.purs']; |
1983893b | 30 | |
63d6a244 | 31 | var ffi = ['bower_components/purescript-*/src/**/*.js', 'src/**/*FFI.js']; |
1983893b | 32 | |
33 | var modulesDirectories = [ | |
34 | 'node_modules', | |
63d6a244 | 35 | 'bower_components' |
1983893b | 36 | ]; |
37 | ||
38 | var config | |
39 | = { entry: './src/entry' | |
40 | , output: { path: __dirname | |
41 | , pathinfo: true | |
42 | , filename: 'bundle.js' | |
43 | } | |
44 | , module: { loaders: [ { test: /\.purs$/ | |
63d6a244 | 45 | , loader: 'purs-loader' |
1983893b | 46 | } ] } |
63d6a244 | 47 | , resolve: { modulesDirectories: modulesDirectories } |
48 | , plugins: [ new PurescriptWebpackPlugin({src: src, ffi: ffi}) ] | |
1983893b | 49 | } |
50 | ; | |
51 | ||
52 | module.exports = config; | |
53 | ``` | |
54 | ||
464355c7 | 55 | See the [example](https://github.com/ethul/purs-loader/tree/master/example) directory for a complete example. |