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): ...@@ -7,7 +7,7 @@ Download the example [or clone the repo](https://github.com/zeit/next.js):
```bash ```bash
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-webpack-bundle-analyzer 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: Install it and run:
...@@ -26,3 +26,5 @@ now ...@@ -26,3 +26,5 @@ now
## The idea behind the example ## 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) 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 = { ...@@ -4,11 +4,11 @@ module.exports = {
// Perform customizations to config // Perform customizations to config
config.plugins.push( config.plugins.push(
new BundleAnalyzerPlugin({ new BundleAnalyzerPlugin({
analyzerMode: 'disabled',
// For all options see https://github.com/th0r/webpack-bundle-analyzer#as-plugin // For all options see https://github.com/th0r/webpack-bundle-analyzer#as-plugin
analyzerMode: 'server', generateStatsFile: true,
analyzerHost: '127.0.0.1', // Will be available at `.next/stats.json`
analyzerPort: 8888, statsFilename: 'stats.json'
openAnalyzer: false
}) })
) )
// Important: return the modified config // Important: return the modified config
......
{ {
"name": "hello-world", "name": "with-webpack-bundle-analyzer",
"version": "1.0.0", "version": "1.0.0",
"scripts": { "scripts": {
"dev": "next", "dev": "next",
"build": "next build", "build": "next build",
"start": "next start" "start": "next start",
"bundle:view": "webpack-bundle-analyzer .next/stats.json"
}, },
"dependencies": { "dependencies": {
"next": "beta", "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