mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Merge branch 'master' into v3-beta
This commit is contained in:
commit
0191d2eb1b
|
@ -7,6 +7,8 @@ import webpack from './build/webpack'
|
|||
import clean from './build/clean'
|
||||
import getConfig from './config'
|
||||
|
||||
const isBundledPage = /^bundles[/\\]pages.*\.js$/
|
||||
|
||||
export default class HotReloader {
|
||||
constructor (dir, { quiet, conf } = {}) {
|
||||
this.dir = dir
|
||||
|
@ -78,7 +80,12 @@ export default class HotReloader {
|
|||
|
||||
compiler.plugin('done', (stats) => {
|
||||
const { compilation } = stats
|
||||
const chunkNames = new Set(compilation.chunks.map((c) => c.name))
|
||||
const chunkNames = new Set(
|
||||
compilation.chunks
|
||||
.map((c) => c.name)
|
||||
.filter(name => isBundledPage.test(name))
|
||||
)
|
||||
|
||||
const failedChunkNames = new Set(compilation.errors
|
||||
.map((e) => e.module.reasons)
|
||||
.reduce((a, b) => a.concat(b), [])
|
||||
|
@ -86,7 +93,11 @@ export default class HotReloader {
|
|||
.reduce((a, b) => a.concat(b), [])
|
||||
.map((c) => c.name))
|
||||
|
||||
const chunkHashes = new Map(compilation.chunks.map((c) => [c.name, c.hash]))
|
||||
const chunkHashes = new Map(
|
||||
compilation.chunks
|
||||
.filter(c => isBundledPage.test(c.name))
|
||||
.map((c) => [c.name, c.hash])
|
||||
)
|
||||
|
||||
if (this.initialized) {
|
||||
// detect chunks which have to be replaced with a new template
|
||||
|
|
Loading…
Reference in a new issue