webpack-dev-server Version: 3.1.0
[ ] This is a bug
webpack-dev-server should default mode to "development", since that will be the developer's intention in the vast majority of cases.
Currently, mode does not have a default, which causes webpack to default it to "production" and emit a warning.
It's understandable for webpack itself to default to production settings if a mode isn't explicitly specified, but since webpack-dev-server is intended only for use in development, it seems reasonable to default to development settings unless the user explicitly overrides them.
@billyjanitsch no, you should set mode manually or using NODE_ENV, changing mode and env inside in code is bad practice. Exmaple:
cross-env NODE_ENV=development webpack-dev-server
I'm with @billyjanitsch here, the default should be development, and I wouldn't deem bad practice to have sensible defaults.
Overriding the default using mode, --mode, or NODE_ENV should still be expected, but the default shouldn't be production IMO.
This would be a really nice enhancement.
webpack-dev-server with default mode production is unexpected to me.
If there was a webpack-production-server, I wouldn't expect it to have default mode development, either.
However, if this repo was called webpack-server, I could understand the argument of not having a default mode (even though that probably goes against the zero-conf policy).
@evilebottnawi Are you kidding?) It's absolutely illogical to have mode=production by default in dev-server. Original message now has 48 upvotes and 0 downvotes, it's for a reason.
Most helpful comment
This would be a really nice enhancement.
webpack-dev-serverwith default modeproductionis unexpected to me.If there was a
webpack-production-server, I wouldn't expect it to have default modedevelopment, either.However, if this repo was called
webpack-server, I could understand the argument of not having a default mode (even though that probably goes against the zero-conf policy).