Commit 450277f2 authored by Arunoda Susiripala's avatar Arunoda Susiripala

Make sure next export doesn't break other modes.

parent 147a5ce6
......@@ -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']
......
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