]> git.immae.eu Git - github/fretlink/purs-loader.git/blame - README.md
Add info about possibility to connect to existing `psc-ide-server`
[github/fretlink/purs-loader.git] / README.md
CommitLineData
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 11Install with [npm](https://npmjs.org/package/purs-loader).
12
a42f24b8 13```
a9a26a84 14npm install purs-loader --save-dev
2b2207bd 15
16npm install purs-loader@next --save-dev
689268da 17
18npm install purs-loader@purescript-0.8 --save-dev
19
20npm install purs-loader@purescript-0.9 --save-dev
9e32e366 21
22npm install purs-loader@purescript-0.10 --save-dev
a42f24b8 23```
24
a42f24b8 25## Example
26
7de41f10
AM
27```javascript
28const webpackConfig = {
29 // ...
30 loaders: [
31 // ...
32 {
33 test: /\.purs$/,
34 loader: 'purs-loader',
35 exclude: /node_modules/,
36 query: {
37 psc: 'psa',
2b2207bd 38 src: ['bower_components/purescript-*/src/**/*.purs', 'src/**/*.purs']
7de41f10
AM
39 }
40 }
41 // ...
42 ]
43 // ...
44}
45```
46
44eb153b 47Refer to the [purescript-webpack-example](https://github.com/ethul/purescript-webpack-example) for a more detailed example.
48
5163b5a2
AM
49### Options
50
7de41f10
AM
51Default options:
52
53```javascript
54{
55 psc: 'psc',
56 pscArgs: {},
57 pscBundle: 'psc-bundle',
58 pscBundleArgs: {},
5163b5a2 59 pscIde: false, // instant rebuilds using psc-ide-server (experimental)
39d11a26 60 pscIdeArgs: {}, // for example, to use different psc-ide-server port: {port: 4088}
7de41f10
AM
61 pscIdeColors: false, // defaults to true if psc === 'psa'
62 bundleOutput: 'output/bundle.js',
63 bundleNamespace: 'PS',
64 bundle: false,
65 warnings: true,
66 output: 'output',
67 src: [
68 path.join('src', '**', '*.purs'),
69 path.join('bower_components', 'purescript-*', 'src', '**', '*.purs')
2b2207bd 70 ]
7de41f10
AM
71}
72```
5163b5a2
AM
73
74### Instant rebuilds (experimental)
75
76Experimental support for instant rebuilds using `psc-ide-server` can be enabled
77via the `pscIde: true` option.
e6582cd4 78You can use already running `psc-ide-server` instance - just define its port in `pscIdeArgs`.