From 50274959cbc5ee5d2ac4ce8c5b700893c9f71a71 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Sun, 26 Mar 2017 11:24:58 -0700 Subject: [PATCH] Revert "Move all NPM modules into a single chunk in dev mode. (#1505)" This reverts commit a879f47f9aa1b11aceea24fc868e1b2f3595c673. --- server/build/webpack.js | 19 ++++--------------- server/document.js | 1 - server/index.js | 6 ------ 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/server/build/webpack.js b/server/build/webpack.js index 804434a32d9f6..0aff98de76cce 100644 --- a/server/build/webpack.js +++ b/server/build/webpack.js @@ -93,26 +93,15 @@ export default async function createCompiler (dir, { dev = false, quiet = false, name: 'commons', filename: 'commons.js', minChunks (module, count) { - // In the dev we use on-demand-entries. - // So, it makes no sense to use commonChunks based on the minChunks count. - // Instead, we move all the code in node_modules into this chunk. - // With that, we could gain better performance for page-rebuild process. - if (dev) { - return module.context && module.context.indexOf('node_modules') >= 0 - } + // In the dev we use on-deman-entries. + // So, it makes no sense to use commonChunks with that. + if (dev) return false // NOTE: it depends on the fact that the entry funtion is always called // before applying CommonsChunkPlugin return count >= minChunks } }), - // This chunk contains all the webpack related code. So, all the changes - // related to that happens to this chunk. - // It won't touch commons.js and that gives us much better re-build perf. - new webpack.optimize.CommonsChunkPlugin({ - name: 'manifest', - filename: 'manifest.js' - }), new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify(dev ? 'development' : 'production') }), @@ -132,7 +121,7 @@ export default async function createCompiler (dir, { dev = false, quiet = false, } else { plugins.push( new CombineAssetsPlugin({ - input: ['manifest.js', 'commons.js', 'main.js'], + input: ['commons.js', 'main.js'], output: 'app.js' }), new webpack.optimize.UglifyJsPlugin({ diff --git a/server/document.js b/server/document.js index 9d25fd6c2fece..d169cfe44af54 100644 --- a/server/document.js +++ b/server/document.js @@ -78,7 +78,6 @@ export class NextScript extends Component { if (dev) { return (
- { this.getChunkScript('manifest.js') } { this.getChunkScript('commons.js') } { this.getChunkScript('main.js') }
diff --git a/server/index.js b/server/index.js index 17a45090cd739..26c58ab5b2293 100644 --- a/server/index.js +++ b/server/index.js @@ -90,12 +90,6 @@ export default class Server { await this.serveStatic(req, res, p) }, - '/_next/:hash/manifest.js': async (req, res, params) => { - this.handleBuildHash('manifest.js', params.hash, res) - const p = join(this.dir, '.next/manifest.js') - await this.serveStatic(req, res, p) - }, - '/_next/:hash/main.js': async (req, res, params) => { this.handleBuildHash('main.js', params.hash, res) const p = join(this.dir, '.next/main.js')