mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-13 09:33:54 +00:00
perf(nuxt): import error component synchronously (#21406)
This commit is contained in:
parent
acdc28a99e
commit
13aae836e8
@ -13,8 +13,8 @@ import { useNuxtApp } from '#app/nuxt'
|
|||||||
import { isNuxtError, showError, useError } from '#app/composables/error'
|
import { isNuxtError, showError, useError } from '#app/composables/error'
|
||||||
import { useRoute } from '#app/composables/router'
|
import { useRoute } from '#app/composables/router'
|
||||||
import AppComponent from '#build/app-component.mjs'
|
import AppComponent from '#build/app-component.mjs'
|
||||||
|
import ErrorComponent from '#build/error-component.mjs'
|
||||||
|
|
||||||
const ErrorComponent = defineAsyncComponent(() => import('#build/error-component.mjs').then(r => r.default || r))
|
|
||||||
const IslandRenderer = process.server
|
const IslandRenderer = process.server
|
||||||
? defineAsyncComponent(() => import('./island-renderer').then(r => r.default || r))
|
? defineAsyncComponent(() => import('./island-renderer').then(r => r.default || r))
|
||||||
: () => null
|
: () => null
|
||||||
|
@ -25,18 +25,17 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM
|
|||||||
|
|
||||||
it('default client bundle size', async () => {
|
it('default client bundle size', async () => {
|
||||||
stats.client = await analyzeSizes('**/*.js', publicDir)
|
stats.client = await analyzeSizes('**/*.js', publicDir)
|
||||||
expect(roundToKilobytes(stats.client.totalBytes)).toMatchInlineSnapshot('"98.5k"')
|
expect(roundToKilobytes(stats.client.totalBytes)).toMatchInlineSnapshot('"97.1k"')
|
||||||
expect(stats.client.files.map(f => f.replace(/\..*\.js/, '.js'))).toMatchInlineSnapshot(`
|
expect(stats.client.files.map(f => f.replace(/\..*\.js/, '.js'))).toMatchInlineSnapshot(`
|
||||||
[
|
[
|
||||||
"_nuxt/entry.js",
|
"_nuxt/entry.js",
|
||||||
"_nuxt/error-component.js",
|
|
||||||
]
|
]
|
||||||
`)
|
`)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('default server bundle size', async () => {
|
it('default server bundle size', async () => {
|
||||||
stats.server = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir)
|
stats.server = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir)
|
||||||
expect(roundToKilobytes(stats.server.totalBytes)).toMatchInlineSnapshot('"62.9k"')
|
expect(roundToKilobytes(stats.server.totalBytes)).toMatchInlineSnapshot('"61.8k"')
|
||||||
|
|
||||||
const modules = await analyzeSizes('node_modules/**/*', serverDir)
|
const modules = await analyzeSizes('node_modules/**/*', serverDir)
|
||||||
expect(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"2286k"')
|
expect(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"2286k"')
|
||||||
|
Loading…
Reference in New Issue
Block a user