]>
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 | ||
a42f24b8 | 15 | ## Example |
16 | ||
1983893b | 17 | ```js |
18 | // webpack.config.js | |
63d6a244 | 19 | 'use strict'; |
1983893b | 20 | |
63d6a244 | 21 | var PurescriptWebpackPlugin = require('purescript-webpack-plugin'); |
1983893b | 22 | |
63d6a244 | 23 | var src = ['bower_components/purescript-*/src/**/*.purs', 'src/**/*.purs']; |
1983893b | 24 | |
63d6a244 | 25 | var ffi = ['bower_components/purescript-*/src/**/*.js', 'src/**/*FFI.js']; |
1983893b | 26 | |
27 | var modulesDirectories = [ | |
28 | 'node_modules', | |
63d6a244 | 29 | 'bower_components' |
1983893b | 30 | ]; |
31 | ||
32 | var config | |
33 | = { entry: './src/entry' | |
34 | , output: { path: __dirname | |
35 | , pathinfo: true | |
36 | , filename: 'bundle.js' | |
37 | } | |
38 | , module: { loaders: [ { test: /\.purs$/ | |
63d6a244 | 39 | , loader: 'purs-loader' |
1983893b | 40 | } ] } |
63d6a244 | 41 | , resolve: { modulesDirectories: modulesDirectories } |
42 | , plugins: [ new PurescriptWebpackPlugin({src: src, ffi: ffi}) ] | |
1983893b | 43 | } |
44 | ; | |
45 | ||
46 | module.exports = config; | |
47 | ``` | |
48 | ||
464355c7 | 49 | See the [example](https://github.com/ethul/purs-loader/tree/master/example) directory for a complete example. |