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
|
||||
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
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
{
|
||||
"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",
|
||||
|
|
Loading…
Reference in a new issue