From 93c4dfe09135117ebe16762d77a41e58a837e310 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 23 Mar 2022 08:10:12 +0000 Subject: [PATCH] fix(vite): resolve `#_config` in base plugin (#3848) --- packages/vite/src/plugins/dynamic-base.ts | 1 + packages/vite/src/server.ts | 1 - packages/vite/src/vite.ts | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vite/src/plugins/dynamic-base.ts b/packages/vite/src/plugins/dynamic-base.ts index 97810fc5f8..7fbd177598 100644 --- a/packages/vite/src/plugins/dynamic-base.ts +++ b/packages/vite/src/plugins/dynamic-base.ts @@ -40,6 +40,7 @@ export const DynamicBasePlugin = createUnplugin(function (options: DynamicBasePl if (id.startsWith('/__NUXT_BASE__')) { return id.replace('/__NUXT_BASE__', '') } + if (id === '#_config') { return '#_config' } return null }, enforce: 'post', diff --git a/packages/vite/src/server.ts b/packages/vite/src/server.ts index 6e59b67fee..c177a8d3f1 100644 --- a/packages/vite/src/server.ts +++ b/packages/vite/src/server.ts @@ -62,7 +62,6 @@ export async function buildServer (ctx: ViteBuildContext) { preferConst: true, format: 'module' }, - external: ['#config'], onwarn (warning, rollupWarn) { if (!['UNUSED_EXTERNAL_IMPORT'].includes(warning.code)) { rollupWarn(warning) diff --git a/packages/vite/src/vite.ts b/packages/vite/src/vite.ts index e170c40df6..e41c21913b 100644 --- a/packages/vite/src/vite.ts +++ b/packages/vite/src/vite.ts @@ -82,7 +82,7 @@ export async function bundle (nuxt: Nuxt) { ] } } - }, + } as ViteOptions, nuxt.options.vite ) }