Fix build-manifest not removing _app files for modern (#8447)
This commit is contained in:
parent
8bd2e433de
commit
9c8aaf9d4b
4 changed files with 42 additions and 1 deletions
|
@ -25,8 +25,9 @@ const generateClientManifest = (
|
|||
): string => {
|
||||
const clientManifest: { [s: string]: string[] } = {}
|
||||
const appDependencies = new Set(assetMap.pages['/_app'])
|
||||
delete assetMap.pages['/_app']
|
||||
|
||||
Object.entries(assetMap.pages).forEach(([page, dependencies]) => {
|
||||
if (page === '/_app') return
|
||||
// Filter out dependencies in the _app entry, because those will have already
|
||||
// been loaded by the client prior to a navigation event
|
||||
const filteredDeps = dependencies.filter(
|
||||
|
|
6
test/integration/chunking-minimal/next.config.js
Normal file
6
test/integration/chunking-minimal/next.config.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
module.exports = {
|
||||
experimental: {
|
||||
modern: true,
|
||||
granularChunks: true
|
||||
}
|
||||
}
|
1
test/integration/chunking-minimal/pages/index.js
Normal file
1
test/integration/chunking-minimal/pages/index.js
Normal file
|
@ -0,0 +1 @@
|
|||
export default () => <p>hi</p>
|
33
test/integration/chunking-minimal/test/index.test.js
Normal file
33
test/integration/chunking-minimal/test/index.test.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* eslint-env jest */
|
||||
/* global jasmine */
|
||||
import { join } from 'path'
|
||||
import { readFile } from 'fs-extra'
|
||||
import { nextBuild } from 'next-test-utils'
|
||||
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 1
|
||||
|
||||
const appDir = join(__dirname, '../')
|
||||
let buildId
|
||||
|
||||
describe('Chunking (minimal)', () => {
|
||||
beforeAll(async () => {
|
||||
await nextBuild(appDir)
|
||||
buildId = await readFile(join(appDir, '.next/BUILD_ID'), 'utf8')
|
||||
})
|
||||
|
||||
it('should have an empty client-manifest', async () => {
|
||||
const manifest = await readFile(
|
||||
join(appDir, '.next/static', buildId, '_buildManifest.js'),
|
||||
'utf8'
|
||||
)
|
||||
expect(manifest).not.toMatch(/\.js/)
|
||||
})
|
||||
|
||||
it('should have an empty modern client-manifest', async () => {
|
||||
const manifest = await readFile(
|
||||
join(appDir, '.next/static', buildId, '_buildManifest.module.js'),
|
||||
'utf8'
|
||||
)
|
||||
expect(manifest).not.toMatch(/\.js/)
|
||||
})
|
||||
})
|
Loading…
Reference in a new issue