-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Feature request: expose errors to plugins #481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Did you look at #542? It has a nice example of how to listen to socket changes. Bit hacky, but it works. That's probably only a temporary solution though. Any feedback on how you want this exposed would be helpful. |
I exposed some events to the window now with 06c7773. An example of how to use it: window.addEventListener('message', function onWebpackMessage (msg) {
if (!msg.data || !msg.data.type) return;
switch(msg.data.type) {
case 'webpackOk':
console.log('bundle compiled ok');
break;
case 'webpackErrors':
console.log('There were some errors', msg.data.data);
break;
}
}, false); Let me know if you have any feedback. It's not released yet. |
Looks good to me https://github.com/mvc-works/webpack-hud/tree/with-new-api Still want to ask if I can get the stripped string, since in the browser people are unlikely to need ANSI escape code. Then I should not need to strip by myself: const errorMsg = webpackMsg.data.map((s) => stripAnsi(s)).join('\n'); |
Sure, can you make a PR for that? Busy atm. |
Closing this since the feature has been implemented. Let me know if you don't like the API or want to make some changes. |
Uh oh!
There was an error while loading. Please reload this page.
By now errors in Webpack is handled like this, an error message:
If that code is exposed then we may get error messages like this with plugins, and it can be quite convenient, as it already was in ClojureScript projects.
update:
I made a prototype https://github.com/mvc-works/webpack-hud
The text was updated successfully, but these errors were encountered: