From df8798fa0eeeb3dfcce14dc10100b03f708b57f6 Mon Sep 17 00:00:00 2001 From: eric thul Date: Sun, 19 Feb 2017 11:29:57 -0500 Subject: Add a watch option Similar to the way psc-ide support works, the purs-loader now tolerates compiler errors when the `watch` option is true. When webpack is being run in watch mode the user can set `watch` to true in order to avoid failing the webpack bundle creation when the PureScript compiler fails. Resolves issue #66 Resolves issue #73 Resolves issue #74 --- src/Psc.js | 7 ++++++- src/index.js | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Psc.js b/src/Psc.js index 4991d5f..ffa32b7 100644 --- a/src/Psc.js +++ b/src/Psc.js @@ -45,7 +45,12 @@ function compile(psModule) { if (errorMessage.length) { psModule.emitError(errorMessage); } - reject(new Error('compilation failed')) + if (options.watch) { + resolve(psModule); + } + else { + reject(new Error('compilation failed')) + } } else { const warningMessage = stderr.join(''); if (options.warnings && warningMessage.length) { diff --git a/src/index.js b/src/index.js index 3f5e6a8..f4a6dff 100644 --- a/src/index.js +++ b/src/index.js @@ -46,6 +46,7 @@ module.exports = function purescriptLoader(source, map) { bundleNamespace: 'PS', bundle: false, warnings: true, + watch: false, output: 'output', src: [ path.join('src', '**', '*.purs'), -- cgit v1.2.3