diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 49 |
1 files changed, 45 insertions, 4 deletions
@@ -61,6 +61,7 @@ const loaderConfig = { | |||
61 | bundleNamespace: 'PS', | 61 | bundleNamespace: 'PS', |
62 | bundle: false, | 62 | bundle: false, |
63 | warnings: true, | 63 | warnings: true, |
64 | watch: false, // indicates if webpack is in watch mode | ||
64 | output: 'output', | 65 | output: 'output', |
65 | src: [ | 66 | src: [ |
66 | path.join('src', '**', '*.purs'), | 67 | path.join('src', '**', '*.purs'), |
@@ -79,8 +80,14 @@ via the `pscIde: true` option. | |||
79 | You can use an already running `psc-ide-server` instance by specifying the port in `pscIdeArgs`, | 80 | You can use an already running `psc-ide-server` instance by specifying the port in `pscIdeArgs`, |
80 | if there is no server running this loader will start one for you. | 81 | if there is no server running this loader will start one for you. |
81 | 82 | ||
83 | ### `psc-package` support (experimental) | ||
84 | |||
85 | Set `pscPackage` query parameter to `true` to enable `psc-package` support. The `psc-package`-supplied source paths | ||
86 | will be appended to `src` parameter. | ||
87 | |||
88 | ### Troubleshooting | ||
82 | 89 | ||
83 | #### Slower webpack startup after using purs-loader ? | 90 | #### Slower webpack startup after enabling psc-ide support? |
84 | 91 | ||
85 | By default, the psc-ide-server will be passed the globs from query.src, this is | 92 | By default, the psc-ide-server will be passed the globs from query.src, this is |
86 | helpful for other tools using psc-ide-server (for example IDE plugins), however | 93 | helpful for other tools using psc-ide-server (for example IDE plugins), however |
@@ -88,7 +95,41 @@ it might result in a slower initial webpack startup time (rebuilds are not | |||
88 | affected). To override the default behaviour, add: | 95 | affected). To override the default behaviour, add: |
89 | `pscIdeServerArgs: { "_": ['your/*globs/here'] }` to the loader config | 96 | `pscIdeServerArgs: { "_": ['your/*globs/here'] }` to the loader config |
90 | 97 | ||
91 | ### `psc-package` support (experimental) | 98 | #### Errors not being displayed in watch mode? |
92 | 99 | ||
93 | Set `pscPackage` query parameter to `true` to enable `psc-package` support. The `psc-package`-supplied source paths | 100 | When the `watch` option is set to `true`, psc errors are appended to |
94 | will be appended to `src` parameter. | 101 | webpack's compilation instance errors array and not passed back as an |
102 | error to the loader's callback. This may result in the error not being | ||
103 | reported by webpack. To display errors, the following plugin may be added | ||
104 | to the webpack config. | ||
105 | |||
106 | ```javascript | ||
107 | const webpackConfig = { | ||
108 | // ... | ||
109 | plugins: [ | ||
110 | function(){ | ||
111 | this.plugin('done', function(stats){ | ||
112 | process.stderr.write(stats.toString('errors-only')); | ||
113 | }); | ||
114 | } | ||
115 | ] | ||
116 | // ... | ||
117 | } | ||
118 | ``` | ||
119 | |||
120 | #### Error `spawn ENOENT` | ||
121 | |||
122 | This is caused when the loader tries to spawn a binary that does not exists | ||
123 | (`file or directory not found`). If you call webpack like `webpack` or | ||
124 | `webpack --watch`, then ensure that all required binaries that the | ||
125 | loader depends on are available in your `$PATH`. | ||
126 | |||
127 | If you run webpack through an npm script (e.g., npm run or npm start) on NixOS, | ||
128 | then it will first attempt to find binaries in `node_packages/.bin`. | ||
129 | If you have the compiler installed through `npm` and it finds it there, this will | ||
130 | cause `ENOENT`on Nix, because [the binary needs to be patched first, but npm will | ||
131 | install the binary that is linked with /lib64/ld-linux-x86-64.so.2 - a file that | ||
132 | will not exist at that path in NixOS](https://github.com/ethul/purescript-webpack-example/issues/5#issuecomment-282492131). | ||
133 | The solution is to simply use the compiler from `haskellPackages.purescript` and | ||
134 | make sure that it's available in `$PATH`. For more information about how to make | ||
135 | it work on Nix, see [Purescript Webpack Example](https://github.com/ethul/purescript-webpack-example#using-globally-installed-binaries) | ||