This repository has been archived by the owner on Dec 22, 2020. It is now read-only.
Can this work with this.emitError
(Loader API) ?
#52
Milestone
this.emitError
(Loader API) ?
#52
I was hoping to make a pull request for this, but I've run into difficulties, so I wondering if anyone else has any thoughts/suggestions. My idea was to allow this loader to work with the emitError function that webpack provides in its loaders. This could either be done by default or via a parameter, but I've not managed to get the basic functionality working yet.
I was aiming towards something like what eslint loader does:
https://github.com/MoOx/eslint-loader/blob/master/index.js#L102
Which with the webpack hot middleware will output a response to the browser similar to what's shown here:
webpack-contrib/webpack-hot-middleware#9 (comment)
So far I have this, but it doesn't emit the error as expected for a failing test. It shows the error in the console, just not on screen or in the browser's console as it usually does with an emitError.
I have however found that if I remove all mocha code, and just emitError on condition of matching a string in the content, that works (albeit not on initial load), so the issue is the mocha code, which I haven't had much experience with.
if (content.indexOf('make error') >= 0) { //Works as expected webpack.emitError('error test'); }
The text was updated successfully, but these errors were encountered: