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:
parent
8eb8034236
commit
742fa6590c
|
@ -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 = () => {
|
||||
|
|
Loading…
Reference in a new issue