]>
Commit | Line | Data |
---|---|---|
1 | # purs-loader | |
2 | ||
3 | > [PureScript](http://www.purescript.org) loader for [webpack](http://webpack.github.io) | |
4 | ||
5 | - Supports hot-reloading and rebuilding of single source files | |
6 | - Dead code elimination using the `bundle` option | |
7 | - Colorized build output using `purescript-psa` and the `psc: "psa"` option | |
8 | ||
9 | ## Install | |
10 | ||
11 | Install with [npm](https://npmjs.org/package/purs-loader). | |
12 | ||
13 | ``` | |
14 | npm install purs-loader --save-dev | |
15 | ||
16 | npm install purs-loader@next --save-dev | |
17 | ``` | |
18 | ||
19 | ## Example | |
20 | ||
21 | ```javascript | |
22 | const webpackConfig = { | |
23 | // ... | |
24 | loaders: [ | |
25 | // ... | |
26 | { | |
27 | test: /\.purs$/, | |
28 | loader: 'purs-loader', | |
29 | exclude: /node_modules/, | |
30 | query: { | |
31 | psc: 'psa', | |
32 | src: ['bower_components/purescript-*/src/**/*.purs', 'src/**/*.purs'] | |
33 | } | |
34 | } | |
35 | // ... | |
36 | ] | |
37 | // ... | |
38 | } | |
39 | ``` | |
40 | ||
41 | Refer to the [purescript-webpack-example](https://github.com/ethul/purescript-webpack-example) for a more detailed example. | |
42 | ||
43 | ### Options | |
44 | ||
45 | Default options: | |
46 | ||
47 | ```javascript | |
48 | { | |
49 | psc: 'psc', | |
50 | pscArgs: {}, | |
51 | pscBundle: 'psc-bundle', | |
52 | pscBundleArgs: {}, | |
53 | pscIde: false, // instant rebuilds using psc-ide-server (experimental) | |
54 | pscIdeColors: false, // defaults to true if psc === 'psa' | |
55 | bundleOutput: 'output/bundle.js', | |
56 | bundleNamespace: 'PS', | |
57 | bundle: false, | |
58 | warnings: true, | |
59 | output: 'output', | |
60 | src: [ | |
61 | path.join('src', '**', '*.purs'), | |
62 | path.join('bower_components', 'purescript-*', 'src', '**', '*.purs') | |
63 | ] | |
64 | } | |
65 | ``` | |
66 | ||
67 | ### Instant rebuilds (experimental) | |
68 | ||
69 | Experimental support for instant rebuilds using `psc-ide-server` can be enabled | |
70 | via the `pscIde: true` option. |