Commit ff547752 authored by Tim Neutkens's avatar Tim Neutkens Committed by Naoyuki Kanezawa

Fix HMR issue with webpack-stats-analyzer (#1149)

* Use stats.json instead of running server

* Add suggested changes
parent 38d236e2
......@@ -7,7 +7,7 @@ Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-webpack-bundle-analyzer
cd hello-world
cd with-webpack-bundle-analyzer
```
Install it and run:
......@@ -26,3 +26,5 @@ now
## The idea behind the example
This example shows how to analyze the output bundles using [webpack-bundle-analyzer](https://github.com/th0r/webpack-bundle-analyzer#as-plugin)
To view the stats use `npm run bundle:view`
......@@ -4,11 +4,11 @@ module.exports = {
// Perform customizations to config
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: 'disabled',
// For all options see https://github.com/th0r/webpack-bundle-analyzer#as-plugin
analyzerMode: 'server',
analyzerHost: '127.0.0.1',
analyzerPort: 8888,
openAnalyzer: false
generateStatsFile: true,
// Will be available at `.next/stats.json`
statsFilename: 'stats.json'
})
)
// Important: return the modified config
......
{
"name": "hello-world",
"name": "with-webpack-bundle-analyzer",
"version": "1.0.0",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
"start": "next start",
"bundle:view": "webpack-bundle-analyzer .next/stats.json"
},
"dependencies": {
"next": "beta",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment