1
0
Fork 0
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:
Tim Neutkens 2018-12-31 19:06:36 +01:00 committed by GitHub
parent 18cb2c03df
commit 662dfd4271
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,7 +14,6 @@ function supportsPreload (list) {
}
const hasPreload = supportsPreload(document.createElement('link').relList)
const webpackModule = module
export default class PageLoader {
constructor (buildId, assetPrefix) {
@ -107,21 +106,24 @@ export default class PageLoader {
}
}
// Wait for webpack to become idle if it's not.
// More info: https://github.com/zeit/next.js/pull/1511
if (webpackModule && webpackModule.hot && webpackModule.hot.status() !== 'idle') {
console.log(`Waiting for webpack to become "idle" to initialize the page: "${route}"`)
if (process.env.NODE_ENV !== 'production') {
// Wait for webpack to become idle if it's not.
// More info: https://github.com/zeit/next.js/pull/1511
if (module.hot && module.hot.status() !== 'idle') {
console.log(`Waiting for webpack to become "idle" to initialize the page: "${route}"`)
const check = (status) => {
if (status === 'idle') {
webpackModule.hot.removeStatusHandler(check)
register()
const check = (status) => {
if (status === 'idle') {
module.hot.removeStatusHandler(check)
register()
}
}
module.hot.status(check)
return
}
webpackModule.hot.status(check)
} else {
register()
}
register()
}
async prefetch (route) {