feat(nuxt): enable appManifest by default (#23448)

This commit is contained in:
Daniel Roe 2023-09-30 10:58:55 +01:00 committed by GitHub
parent 9734723aaf
commit 4063b498d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 11 deletions

View File

@ -20,7 +20,7 @@ export default defineUntypedSchema({
*/ */
reactivityTransform: false, reactivityTransform: false,
// TODO: Remove in v3.8 when nitro has support for mocking traced dependencies // TODO: Remove when nitro has support for mocking traced dependencies
// https://github.com/unjs/nitro/issues/1118 // https://github.com/unjs/nitro/issues/1118
/** /**
* Externalize `vue`, `@vue/*` and `vue-router` when building. * Externalize `vue`, `@vue/*` and `vue-router` when building.
@ -210,8 +210,7 @@ export default defineUntypedSchema({
/** /**
* Use app manifests to respect route rules on client-side. * Use app manifests to respect route rules on client-side.
*/ */
// TODO: enable by default in v3.8 appManifest: true,
appManifest: false,
// This is enabled when `experimental.payloadExtraction` is set to `true`. // This is enabled when `experimental.payloadExtraction` is set to `true`.
// appManifest: { // appManifest: {

View File

@ -11,7 +11,7 @@ import type { NuxtIslandResponse } from '../packages/nuxt/src/core/runtime/nitro
import { expectNoClientErrors, expectWithPolling, gotoPath, isRenderingJson, parseData, parsePayload, renderPage } from './utils' import { expectNoClientErrors, expectWithPolling, gotoPath, isRenderingJson, parseData, parsePayload, renderPage } from './utils'
const isWebpack = process.env.TEST_BUILDER === 'webpack' const isWebpack = process.env.TEST_BUILDER === 'webpack'
const isTestingAppManifest = process.env.TEST_MANIFEST === 'manifest-on' const isTestingAppManifest = process.env.TEST_MANIFEST !== 'manifest-off'
await setup({ await setup({
rootDir: fileURLToPath(new URL('./fixtures/basic', import.meta.url)), rootDir: fileURLToPath(new URL('./fixtures/basic', import.meta.url)),

View File

@ -19,7 +19,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM
for (const outputDir of ['.output', '.output-inline']) { for (const outputDir of ['.output', '.output-inline']) {
it('default client bundle size', async () => { it('default client bundle size', async () => {
const clientStats = await analyzeSizes('**/*.js', join(rootDir, outputDir, 'public')) const clientStats = await analyzeSizes('**/*.js', join(rootDir, outputDir, 'public'))
expect.soft(roundToKilobytes(clientStats.totalBytes)).toMatchInlineSnapshot('"97.3k"') expect.soft(roundToKilobytes(clientStats.totalBytes)).toMatchInlineSnapshot('"99.1k"')
expect(clientStats.files.map(f => f.replace(/\..*\.js/, '.js'))).toMatchInlineSnapshot(` expect(clientStats.files.map(f => f.replace(/\..*\.js/, '.js'))).toMatchInlineSnapshot(`
[ [
"_nuxt/entry.js", "_nuxt/entry.js",
@ -32,7 +32,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM
const serverDir = join(rootDir, '.output/server') const serverDir = join(rootDir, '.output/server')
const serverStats = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir) const serverStats = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir)
expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot('"300k"') expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot('"304k"')
const modules = await analyzeSizes('node_modules/**/*', serverDir) const modules = await analyzeSizes('node_modules/**/*', serverDir)
expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"1822k"') expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"1822k"')
@ -71,7 +71,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM
const serverDir = join(rootDir, '.output-inline/server') const serverDir = join(rootDir, '.output-inline/server')
const serverStats = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir) const serverStats = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir)
expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot('"607k"') expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot('"611k"')
const modules = await analyzeSizes('node_modules/**/*', serverDir) const modules = await analyzeSizes('node_modules/**/*', serverDir)
expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"71.4k"') expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"71.4k"')

View File

@ -195,9 +195,7 @@ export default defineNuxtConfig({
reactivityTransform: true, reactivityTransform: true,
treeshakeClientOnly: true, treeshakeClientOnly: true,
asyncContext: process.env.TEST_CONTEXT === 'async', asyncContext: process.env.TEST_CONTEXT === 'async',
// TODO: remove this in v3.8 appManifest: process.env.TEST_MANIFEST !== 'manifest-off',
payloadExtraction: true,
appManifest: process.env.TEST_MANIFEST === 'manifest-on',
headNext: true, headNext: true,
inlineRouteRules: true inlineRouteRules: true
}, },

View File

@ -233,7 +233,7 @@ describe('url', () => {
}) })
}) })
describe.skipIf(process.env.TEST_MANIFEST !== 'manifest-on')('app manifests', () => { describe.skipIf(process.env.TEST_MANIFEST === 'manifest-off')('app manifests', () => {
it('getAppManifest', async () => { it('getAppManifest', async () => {
const manifest = await getAppManifest() const manifest = await getAppManifest()
delete manifest.timestamp delete manifest.timestamp