mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Drop module.hot from production bundles (#5967)
This commit is contained in:
parent
18cb2c03df
commit
662dfd4271
|
@ -14,7 +14,6 @@ function supportsPreload (list) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasPreload = supportsPreload(document.createElement('link').relList)
|
const hasPreload = supportsPreload(document.createElement('link').relList)
|
||||||
const webpackModule = module
|
|
||||||
|
|
||||||
export default class PageLoader {
|
export default class PageLoader {
|
||||||
constructor (buildId, assetPrefix) {
|
constructor (buildId, assetPrefix) {
|
||||||
|
@ -107,21 +106,24 @@ export default class PageLoader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for webpack to become idle if it's not.
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
// More info: https://github.com/zeit/next.js/pull/1511
|
// Wait for webpack to become idle if it's not.
|
||||||
if (webpackModule && webpackModule.hot && webpackModule.hot.status() !== 'idle') {
|
// More info: https://github.com/zeit/next.js/pull/1511
|
||||||
console.log(`Waiting for webpack to become "idle" to initialize the page: "${route}"`)
|
if (module.hot && module.hot.status() !== 'idle') {
|
||||||
|
console.log(`Waiting for webpack to become "idle" to initialize the page: "${route}"`)
|
||||||
|
|
||||||
const check = (status) => {
|
const check = (status) => {
|
||||||
if (status === 'idle') {
|
if (status === 'idle') {
|
||||||
webpackModule.hot.removeStatusHandler(check)
|
module.hot.removeStatusHandler(check)
|
||||||
register()
|
register()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
module.hot.status(check)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
webpackModule.hot.status(check)
|
|
||||||
} else {
|
|
||||||
register()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
register()
|
||||||
}
|
}
|
||||||
|
|
||||||
async prefetch (route) {
|
async prefetch (route) {
|
||||||
|
|
Loading…
Reference in a new issue