Default to use NamedModulesPlugin when not building for production

Do you want to request a feature or report a bug?
Feature

What is the current behavior?
Module ids are numbers, making it unusable in HMR, and less useful than it could be when stepping though the code in the browser.

If this is a feature request, what is motivation or use case for changing the behavior?
I know there’s a warning printed when using HMR and not the named plugin (6b4ced4), but it’s useful also for bundles in the browser. The only time you might not want it is in production builds, because numbers take up fewer bytes, but then I think NamedModulesPlugin should just check for minimize-mode, and noop in that case.

Please mention other relevant information such as the browser version, Node.js version, Operating System and programming language.
N/A

Ref: facebook/create-react-app#1228

Author: Fantashit

3 thoughts on “Default to use NamedModulesPlugin when not building for production

  1. The point isn’t that it’s easy to do yourself, the point is that webpack has a bajillion options and plugins, and making the default experience better should be done whenever possible.
    If anything, it should be the default all over, and you can switch to using numbers manually if you want to for production

  2. I’d like to second @SimenB on this, would be great to have 1 less thing to worry about in our Webpack config.
    I think that --optimize-minimize and/or process.env.NODE_ENV=production are safe to rely upon, as -p already enables them.

  3. FWIW, according to the release notes of webpack 4 NamedModulesPlugin is now enabled by default for development

Comments are closed.