mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Make sure next export doesn't break other modes.
This commit is contained in:
parent
147a5ce641
commit
450277f294
|
@ -105,5 +105,10 @@ export default class PageLoader {
|
|||
route = this.normalizeRoute(route)
|
||||
delete this.pageCache[route]
|
||||
delete this.loadingRoutes[route]
|
||||
|
||||
const script = document.getElementById(`__NEXT_PAGE__${route}`)
|
||||
if (script) {
|
||||
script.parentNode.removeChild(script)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ export default class Server {
|
|||
await this.serveStatic(req, res, p)
|
||||
},
|
||||
|
||||
'/_next/:buildId/page/_error': async (req, res, params) => {
|
||||
'/_next/:buildId/page/_error*': async (req, res, params) => {
|
||||
if (!this.handleBuildId(params.buildId, res)) {
|
||||
const error = new Error('INVALID_BUILD_ID')
|
||||
const customFields = { buildIdMismatched: true }
|
||||
|
|
|
@ -20,6 +20,7 @@ describe('Router', () => {
|
|||
const request = { clone: () => null }
|
||||
describe('.prefetch()', () => {
|
||||
it('should prefetch a given page', async () => {
|
||||
global.__NEXT_DATA__ = {}
|
||||
const pageLoader = new PageLoader()
|
||||
const router = new Router('/', {}, '/', { pageLoader })
|
||||
const route = '/routex'
|
||||
|
@ -29,6 +30,7 @@ describe('Router', () => {
|
|||
})
|
||||
|
||||
it('should only run two jobs at a time', async () => {
|
||||
global.__NEXT_DATA__ = {}
|
||||
// delay loading pages for an hour
|
||||
const pageLoader = new PageLoader({ delay: 1000 * 3600 })
|
||||
const router = new Router('/', {}, '/', { pageLoader })
|
||||
|
@ -46,6 +48,7 @@ describe('Router', () => {
|
|||
})
|
||||
|
||||
it('should run all the jobs', async () => {
|
||||
global.__NEXT_DATA__ = {}
|
||||
const pageLoader = new PageLoader()
|
||||
const router = new Router('/', {}, '/', { pageLoader })
|
||||
const routes = ['route1', 'route2', 'route3', 'route4']
|
||||
|
|
Loading…
Reference in a new issue