]>
Commit | Line | Data |
---|---|---|
a42f24b8 | 1 | # purs-loader |
2 | ||
08b34471 | 3 | > [PureScript](http://www.purescript.org) loader for [webpack](http://webpack.github.io) |
a42f24b8 | 4 | |
7de41f10 AM |
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 | ||
a42f24b8 | 9 | ## Install |
10 | ||
63d6a244 | 11 | Install with [npm](https://npmjs.org/package/purs-loader). |
12 | ||
a42f24b8 | 13 | ``` |
a9a26a84 | 14 | npm install purs-loader --save-dev |
2b2207bd | 15 | |
16 | npm install purs-loader@next --save-dev | |
a42f24b8 | 17 | ``` |
18 | ||
a42f24b8 | 19 | ## Example |
20 | ||
7de41f10 AM |
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', | |
2b2207bd | 32 | src: ['bower_components/purescript-*/src/**/*.purs', 'src/**/*.purs'] |
7de41f10 AM |
33 | } |
34 | } | |
35 | // ... | |
36 | ] | |
37 | // ... | |
38 | } | |
39 | ``` | |
40 | ||
44eb153b | 41 | Refer to the [purescript-webpack-example](https://github.com/ethul/purescript-webpack-example) for a more detailed example. |
42 | ||
5163b5a2 AM |
43 | ### Options |
44 | ||
7de41f10 AM |
45 | Default options: |
46 | ||
47 | ```javascript | |
48 | { | |
49 | psc: 'psc', | |
50 | pscArgs: {}, | |
51 | pscBundle: 'psc-bundle', | |
52 | pscBundleArgs: {}, | |
5163b5a2 | 53 | pscIde: false, // instant rebuilds using psc-ide-server (experimental) |
7de41f10 AM |
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') | |
2b2207bd | 63 | ] |
7de41f10 AM |
64 | } |
65 | ``` | |
5163b5a2 AM |
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. |