mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Fix HMR issue with webpack-stats-analyzer (#1149)
* Use stats.json instead of running server * Add suggested changes
This commit is contained in:
parent
38d236e2b3
commit
ff547752f0
|
@ -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
|
||||||
## 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 = {
|
||||||
// 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
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
{
|
{
|
||||||
"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",
|
||||||
|
|
Loading…
Reference in a new issue