aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/index.js b/src/index.js
index cc779f7..b151d82 100644
--- a/src/index.js
+++ b/src/index.js
@@ -40,6 +40,7 @@ var CACHE_VAR = {
40 errors: [], 40 errors: [],
41 compilationStarted: false, 41 compilationStarted: false,
42 compilationFinished: false, 42 compilationFinished: false,
43 compilationFailed: false,
43 installed: false, 44 installed: false,
44 srcOption: [] 45 srcOption: []
45}; 46};
@@ -147,6 +148,7 @@ module.exports = function purescriptLoader(source, map) {
147 errors: [], 148 errors: [],
148 compilationStarted: false, 149 compilationStarted: false,
149 compilationFinished: false, 150 compilationFinished: false,
151 compilationFailed: false,
150 installed: CACHE_VAR.installed, 152 installed: CACHE_VAR.installed,
151 srcOption: [] 153 srcOption: []
152 }; 154 };
@@ -258,6 +260,8 @@ module.exports = function purescriptLoader(source, map) {
258 ) 260 )
259 ) 261 )
260 .catch(error => { 262 .catch(error => {
263 CACHE_VAR.compilationFailed = true;
264
261 CACHE_VAR.deferred[0].reject(error); 265 CACHE_VAR.deferred[0].reject(error);
262 266
263 CACHE_VAR.deferred.slice(1).forEach(psModule => { 267 CACHE_VAR.deferred.slice(1).forEach(psModule => {
@@ -265,8 +269,9 @@ module.exports = function purescriptLoader(source, map) {
265 }) 269 })
266 }) 270 })
267 ; 271 ;
268 } 272 } else if (CACHE_VAR.compilationFailed) {
269 else { 273 CACHE_VAR.deferred.pop().reject(new Error('purs-loader failed'));
274 } else {
270 // The compilation has started. We must wait until it is 275 // The compilation has started. We must wait until it is
271 // done in order to ensure the module map contains all of 276 // done in order to ensure the module map contains all of
272 // the unknown modules. 277 // the unknown modules.
@@ -318,6 +323,8 @@ module.exports = function purescriptLoader(source, map) {
318 ) 323 )
319 ) 324 )
320 .catch(error => { 325 .catch(error => {
326 CACHE_VAR.compilationFailed = true;
327
321 CACHE_VAR.deferred[0].reject(error); 328 CACHE_VAR.deferred[0].reject(error);
322 329
323 CACHE_VAR.deferred.slice(1).forEach(psModule => { 330 CACHE_VAR.deferred.slice(1).forEach(psModule => {
@@ -325,8 +332,9 @@ module.exports = function purescriptLoader(source, map) {
325 }) 332 })
326 }) 333 })
327 ; 334 ;
328 } 335 } else if (CACHE_VAR.compilationFailed) {
329 else { 336 CACHE_VAR.deferred.pop().reject(new Error('purs-loader failed'));
337 } else {
330 // The complation has started. Nothing to do but wait until it is 338 // The complation has started. Nothing to do but wait until it is
331 // done before loading all of the modules. 339 // done before loading all of the modules.
332 } 340 }