Webpack-dev-server: Default mode to development?

Created on 1 Mar 2018  路  4Comments  路  Source: webpack/webpack-dev-server

  • Operating System: macOS 10.13.3
  • Node Version: 8.9.4
  • NPM Version: 5.7.1
  • webpack Version: 4.0.1
  • webpack-dev-server Version: 3.1.0

  • [ ] This is a bug

  • [x] This is a modification request

Expected Behavior

webpack-dev-server should default mode to "development", since that will be the developer's intention in the vast majority of cases.

Actual Behavior

Currently, mode does not have a default, which causes webpack to default it to "production" and emit a warning.

For Bugs; How can we reproduce the behavior?

For Features; What is the motivation and/or use-case for the feature?

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.

Most helpful comment

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).

All 4 comments

@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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

antoinerousseau picture antoinerousseau  路  3Comments

mischkl picture mischkl  路  3Comments

daryn-k picture daryn-k  路  3Comments

da2018 picture da2018  路  3Comments

mrdulin picture mrdulin  路  3Comments