1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Fix statically exported pages from hanging (#2930)

* fix script loading errors not reported if exported

* fix lint
This commit is contained in:
Jonas Budelmann 2017-11-24 02:05:17 +13:00 committed by Tim Neutkens
parent 8eb8034236
commit 742fa6590c

View file

@ -69,13 +69,14 @@ export default class PageLoader {
loadScript (route) {
route = this.normalizeRoute(route)
let scriptRoute = route
if (__NEXT_DATA__.nextExport) {
route = route === '/' ? '/index.js' : `${route}/index.js`
scriptRoute = route === '/' ? '/index.js' : `${route}/index.js`
}
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.type = 'text/javascript'
script.onerror = () => {