aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/index.js
diff options
context:
space:
mode:
authoreric thul <thul.eric@gmail.com>2016-11-19 13:57:32 -0500
committereric thul <thul.eric@gmail.com>2016-11-19 13:57:32 -0500
commit45c62a2c766132a13c546b19025e9c1ef25bcd5b (patch)
tree108c0b3403f6b4ff2afbc85eca8532f305c94f77 /src/index.js
parent28124e28f18c5aae38e149a3fc9624b46a906281 (diff)
downloadpurs-loader-45c62a2c766132a13c546b19025e9c1ef25bcd5b.tar.gz
purs-loader-45c62a2c766132a13c546b19025e9c1ef25bcd5b.tar.zst
purs-loader-45c62a2c766132a13c546b19025e9c1ef25bcd5b.zip
Use emitError and emitWarning
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/index.js b/src/index.js
index f3b2fde..7c29650 100644
--- a/src/index.js
+++ b/src/index.js
@@ -62,21 +62,6 @@ module.exports = function purescriptLoader(source, map) {
62 psModuleMap: cache.psModuleMap 62 psModuleMap: cache.psModuleMap
63 } 63 }
64 }) 64 })
65
66 // add psc warnings to webpack compilation warnings
67 this._compiler.plugin('after-compile', (compilation, callback) => {
68 if (options.warnings && cache.warnings) {
69 compilation.warnings.unshift(`PureScript compilation:\n${cache.warnings}`)
70 cache.warnings = null;
71 }
72
73 if (cache.errors) {
74 compilation.errors.unshift(`PureScript compilation:\n${cache.errors}`)
75 cache.errors = null;
76 }
77
78 callback()
79 })
80 } 65 }
81 66
82 const psModuleName = PsModuleMap.match(source) 67 const psModuleName = PsModuleMap.match(source)
@@ -89,6 +74,8 @@ module.exports = function purescriptLoader(source, map) {
89 jsPath: path.resolve(path.join(options.output, psModuleName, 'index.js')), 74 jsPath: path.resolve(path.join(options.output, psModuleName, 'index.js')),
90 options: options, 75 options: options,
91 cache: cache, 76 cache: cache,
77 emitWarning: warning => this.emitWarning(warning),
78 emitError: error => this.emitError(error)
92 } 79 }
93 80
94 debug('loader called', psModule.name) 81 debug('loader called', psModule.name)