Webpack v4.12 is not respecting setting the mode via webpack.config.js file

Bug report

Webpack v4.12 is not respecting setting the mode via config file.

What is the current behavior?

If I set the mode with module.exports in the webpack.config.js, I receive the configuration warning that the mode is not set.

If the current behavior is a bug, please provide the steps to reproduce.

If I make a webpack.config.js in the root with this configuration:

module.exports = {
  mode: 'none'
};

And I run npm run webpack via the webpack in scripts in my package.json:

 "scripts": {
    "webpack": "webpack",
  }

But I receive the configuration warning that the mode is not set.

configuration
  0:0  warning  The 'mode' option has not been set, webpack will fallback to
                'production' for this value. Set 'mode' option to 'development' or
                'production' to enable defaults for each environment.

What is the expected behavior?

Same exact config sets the mode just fine in v4.8 with no configuration warning…. but not in v4.12. The webpack documentation does not outline any sort of changes with this process https://webpack.js.org/concepts/mode/#mode-none — so I’m guessing this is a bug.

Other relevant information:
webpack version: v4.12
Node.js version: v9.9
Operating System: macOS
Additional tools: VS Code

Author: Fantashit

1 thought on “Webpack v4.12 is not respecting setting the mode via webpack.config.js file

Comments are closed.