server.js: Add --config flag for different local webpack config files#4613
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4613 +/- ##
=======================================
Coverage ? 88.61%
=======================================
Files ? 294
Lines ? 26095
Branches ? 7035
=======================================
Hits ? 23125
Misses ? 2765
Partials ? 205 ☔ View full report in Codecov by Sentry. |
julienw
left a comment
There was a problem hiding this comment.
Thanks for the patch!
My main concern is about the security of this: indeed require will gladly execute anything that's fed to it. But I think it's fine as long as we don't accept environment variables to provide this information.
Also it's not 100% clear what you'll do with that to support my comment #4452 (review) but I'll wait and see :-)
This pr adds a
--config/-cflag toserver.jsto allow use of local webpack config files other thanwebpack.local-config.js.This addition is primarily to support scripts that invoke
server.jsto safely override the settings inwebpack.local-config.js, since modifyingwebpack.local-config.jsdirectly is fraught with danger (e.g. what happens if the invoking script orserver.jsabruptly terminates?). Specifically, this addition is to support the request here (hopefully I've understood correctly) to have a separate Node.js script runserver.js.Another use case is to easily switch between different webpack config files that perhaps open different browsers. But honestly this is secondary to the above.