fix(vite): externalize config at rollup, not ssr level (#2971)

This commit is contained in:
Daniel Roe 2022-01-31 10:54:48 +00:00 committed by GitHub
parent 33f6c3ef74
commit b110c8c96c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,7 +40,6 @@ export async function buildServer (ctx: ViteBuildContext) {
} }
}, },
ssr: { ssr: {
external: ['#config'],
noExternal: [ noExternal: [
...ctx.nuxt.options.build.transpile, ...ctx.nuxt.options.build.transpile,
// TODO: Use externality for production (rollup) build // TODO: Use externality for production (rollup) build
@ -63,6 +62,7 @@ export async function buildServer (ctx: ViteBuildContext) {
preferConst: true, preferConst: true,
format: 'module' format: 'module'
}, },
external: ['#config'],
onwarn (warning, rollupWarn) { onwarn (warning, rollupWarn) {
if (!['UNUSED_EXTERNAL_IMPORT'].includes(warning.code)) { if (!['UNUSED_EXTERNAL_IMPORT'].includes(warning.code)) {
rollupWarn(warning) rollupWarn(warning)