Reputation: 26104
When I run the following command I get an empty stats.json file:
webpack --env production --profile --json --output-filename stats.json
Upvotes: 5
Views: 10854
Reputation: 7167
Was having issues with a windows 10 machine. How it worked for me:
On command line (powershell was not working) go to the folder with the package.json and set the environment to production:
$ set NODE_ENV=production
Run webpack with no single quotes and without an output file, just redirect the output to stats.json:
$ webpack --profile --json --config=config\webpack.config.prod.js > stats.json
After this, you should have a stats.json that should show you some info at http://webpack.github.io/analyse/
Upvotes: 1
Reputation: 26104
I discovered that as I was using different Webpack config files for dev and production environmnets, I needed to include the --config
option in the command:
webpack --env production --profile --json --config='webpack.config.prod.js' --output-filename='stats.json'
Upvotes: 10