Unverified Commit 662dfd42 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Drop module.hot from production bundles (#5967)

parent 18cb2c03
...@@ -14,7 +14,6 @@ function supportsPreload (list) { ...@@ -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 { ...@@ -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) => {
if (status === 'idle') { const check = (status) => {
webpackModule.hot.removeStatusHandler(check) if (status === 'idle') {
register() module.hot.removeStatusHandler(check)
register()
}
} }
module.hot.status(check)
return
} }
webpackModule.hot.status(check)
} else {
register()
} }
register()
} }
async prefetch (route) { async prefetch (route) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment