Commit 742fa659 authored by Jonas Budelmann's avatar Jonas Budelmann Committed by Tim Neutkens

Fix statically exported pages from hanging (#2930)

* fix script loading errors not reported if exported

* fix lint
parent 8eb80342
...@@ -69,13 +69,14 @@ export default class PageLoader { ...@@ -69,13 +69,14 @@ export default class PageLoader {
loadScript (route) { loadScript (route) {
route = this.normalizeRoute(route) route = this.normalizeRoute(route)
let scriptRoute = route
if (__NEXT_DATA__.nextExport) { if (__NEXT_DATA__.nextExport) {
route = route === '/' ? '/index.js' : `${route}/index.js` scriptRoute = route === '/' ? '/index.js' : `${route}/index.js`
} }
const script = document.createElement('script') const script = document.createElement('script')
const url = `${this.assetPrefix}/_next/${encodeURIComponent(this.buildId)}/page${route}` const url = `${this.assetPrefix}/_next/${encodeURIComponent(this.buildId)}/page${scriptRoute}`
script.src = url script.src = url
script.type = 'text/javascript' script.type = 'text/javascript'
script.onerror = () => { script.onerror = () => {
......
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