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 webpackModule = module
|
||||
|
||||
export default class PageLoader {
|
||||
constructor (buildId, assetPrefix) {
|
||||
|
@ -107,23 +106,26 @@ export default class PageLoader {
|
|||
}
|
||||
}
|
||||
|
||||
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 (webpackModule && webpackModule.hot && webpackModule.hot.status() !== 'idle') {
|
||||
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)
|
||||
module.hot.removeStatusHandler(check)
|
||||
register()
|
||||
}
|
||||
}
|
||||
webpackModule.hot.status(check)
|
||||
} else {
|
||||
register()
|
||||
module.hot.status(check)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
register()
|
||||
}
|
||||
|
||||
async prefetch (route) {
|
||||
route = this.normalizeRoute(route)
|
||||
const scriptRoute = route === '/' ? '/index.js' : `${route}.js`
|
||||
|
|
Loading…
Reference in a new issue