Skip to content
Devanand edited this page Jan 16, 2017 · 1 revision

Frequently Asked Questions

My code isn't being minified.

Minification will only be performed, when your NODE_ENV is set to production. Not only will this speed up your compilation time, but it's also unnecessary during development. Here's an example of running Webpack for production.

export NODE_ENV=production && webpack --progress --hide-modules

It's highly recommended that you add the following NPM scripts to your package.json file.

  "scripts": {
    "webpack": "cross-env NODE_ENV=development webpack --progress --hide-modules",
    "dev": "cross-env NODE_ENV=development webpack --watch --progress --hide-modules",
    "hmr": "cross-env NODE_ENV=development webpack-dev-server --inline --hot",
    "production": "cross-env NODE_ENV=production webpack --progress --hide-modules"
  },

I'm using a VM, and Webpack isn't picking up my file changes.

If you're running npm run dev through a VM, you may find that file changes are not picked up by Webpack. If that's the case, update your NPM script to use the --watch-poll flag, rather than --watch. Like this:

"scripts": {
    "dev": "NODE_ENV=development webpack --watch --watch-poll",
  }