]> git.immae.eu Git - github/fretlink/purs-loader.git/blob - README.md
Always resolve on psc-ide rebuild failure
[github/fretlink/purs-loader.git] / README.md
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 // For PureScript 0.9 and newer
15 npm install purs-loader --save-dev
16
17 // Fore PureScript 0.8
18 npm install purs-loader@purescript-0.8 --save-dev
19 ```
20
21 ## Example
22
23 ```javascript
24 const webpackConfig = {
25 // ...
26 loaders: [
27 // ...
28 {
29 test: /\.purs$/,
30 loader: 'purs-loader',
31 exclude: /node_modules/,
32 query: {
33 psc: 'psa',
34 src: ['bower_components/purescript-*/src/**/*.purs', 'src/**/*.purs']
35 }
36 }
37 // ...
38 ]
39 // ...
40 }
41 ```
42
43 Refer to the [purescript-webpack-example](https://github.com/ethul/purescript-webpack-example) for a more detailed example.
44
45 ### Options
46
47 Default options:
48
49 ```javascript
50 {
51 psc: 'psc',
52 pscArgs: {},
53 pscBundle: 'psc-bundle',
54 pscBundleArgs: {},
55 pscIde: false, // instant rebuilds using psc-ide-server (experimental)
56 pscIdeArgs: {}, // for example, to use different psc-ide-server port: {port: 4088}
57 pscIdeColors: false, // defaults to true if psc === 'psa'
58 bundleOutput: 'output/bundle.js',
59 bundleNamespace: 'PS',
60 bundle: false,
61 warnings: true,
62 output: 'output',
63 src: [
64 path.join('src', '**', '*.purs'),
65 path.join('bower_components', 'purescript-*', 'src', '**', '*.purs')
66 ]
67 }
68 ```
69
70 ### Instant rebuilds (experimental)
71
72 Experimental support for instant rebuilds using `psc-ide-server` can be enabled
73 via the `pscIde: true` option.
74 You can use an already running `psc-ide-server` instance by specifying the port in `pscIdeArgs`.