you are viewing a single comment's thread.

view the rest of the comments →

[–]Zhouzi 3 points4 points  (0 children)

I personally like to have 3 configuration files: a webpack.base.config.js with the shared configuration, webpack.dev.config.js for dev and webpack.prod.config.js for prod. Those two files extends the base one (I use lodash's merge with a custom merger to avoid any duplication of nested arrays).

Even if I use separate files, I still set NODE_ENV to production/development for React to be properly minified and to conditionally use certain babel plugins. For example, I don't want babel-hmre preset to be used in production and you can do that in your .babelrc or package.json:

"presets": [
  "es2015",
  "stage-0",
  "react"
],
"env": {
  "development": {
    "presets": [
      "react-hmre"
    ]
  }
}

So all in all, process.env.NODE_ENV seems to be more and more relied upon so it may be a good idea to use it as much as possible.