langri-sha / screeps-webpack-plugin

Bundle and push your AI to Screeps servers
MIT License
5 stars 4 forks source link

Code is still uploaded, even on loader error #31

Open bryanbecker opened 7 years ago

bryanbecker commented 7 years ago

See https://github.com/screepers/screeps-typescript-starter/issues/49

I'm not sure if the issue is here or not, but it looks like it can be handled here.

Using webpack NoEmitOnErrorsPlugin can have webpack skip the emit.

Is it possible to have the screeps plugin abort if there is an error (or upload during the emit stage)?

bryanbecker commented 7 years ago

--bail commandline option will stop webpack hard on an error, but doesn't play nice with watch mode.

Maybe some discussion on which way to handle this error will be useful, since everything involves some tradeoffs

langri-sha commented 7 years ago

Would definitely make sense to provide an option to skip uploads when a compilation has errors. Not sure if this should be the default behavior, if others would like to upload in spite of ESLint errors or something.

In either case, when this behavior kicks in it would be nice to log a warning that nothing was uploaded (in which case I hope the user will have an error printed they can inspect for the reason why).

bryanbecker commented 7 years ago

I'm not that well versed in webpack plugins, but I think they hook into the various events/stages to run, correct?

Would it be possible/practical to have the screeps-webpack-plugin run on the emit stage instead of the compile stage (browsing through the source, it looks like it runs on the compile stage)?

This way the built-in NoEmitOnErrors can take over, and we can customize the exact rules based on build environment

Another possible option is to make the screep-webpack-plugin itself configurable