From 467170bf167e7ea7e76209a252b0921fd82b5fd5 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 18 Aug 2022 09:44:22 +0200 Subject: [PATCH 1/3] feat(vite): dedupe vue by default --- packages/schema/src/config/vite.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/schema/src/config/vite.ts b/packages/schema/src/config/vite.ts index 0a194fa57a1..f28900df89e 100644 --- a/packages/schema/src/config/vite.ts +++ b/packages/schema/src/config/vite.ts @@ -26,7 +26,10 @@ export default { }) }, resolve: { - extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'] + extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'], + resolve: { + dedupe: ['vue'] + } }, publicDir: { $resolve: (val, get) => val ?? resolve(get('srcDir'), get('dir').public) From 5ed9565cd3ead2850ac18df9549156c92c19fa10 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 18 Aug 2022 10:00:52 +0200 Subject: [PATCH 2/3] refactor: apply for vite client config only --- packages/schema/src/config/vite.ts | 5 +---- packages/vite/src/client.ts | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/schema/src/config/vite.ts b/packages/schema/src/config/vite.ts index f28900df89e..0a194fa57a1 100644 --- a/packages/schema/src/config/vite.ts +++ b/packages/schema/src/config/vite.ts @@ -26,10 +26,7 @@ export default { }) }, resolve: { - extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'], - resolve: { - dedupe: ['vue'] - } + extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'] }, publicDir: { $resolve: (val, get) => val ?? resolve(get('srcDir'), get('dir').public) diff --git a/packages/vite/src/client.ts b/packages/vite/src/client.ts index 35001c19ed3..f815f944dcd 100644 --- a/packages/vite/src/client.ts +++ b/packages/vite/src/client.ts @@ -43,6 +43,9 @@ export async function buildClient (ctx: ViteBuildContext) { alias: { '#build/plugins': resolve(ctx.nuxt.options.buildDir, 'plugins/client'), '#internal/nitro': resolve(ctx.nuxt.options.buildDir, 'nitro.client.mjs') + }, + resolve: { + dedupe: ['vue'] } }, build: { From 8a73621116b22fa073f5a2df80e2ec07b18ede90 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 18 Aug 2022 10:01:38 +0200 Subject: [PATCH 3/3] fix: remove dupe wrapper --- packages/vite/src/client.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/vite/src/client.ts b/packages/vite/src/client.ts index f815f944dcd..f896f07b30b 100644 --- a/packages/vite/src/client.ts +++ b/packages/vite/src/client.ts @@ -44,9 +44,7 @@ export async function buildClient (ctx: ViteBuildContext) { '#build/plugins': resolve(ctx.nuxt.options.buildDir, 'plugins/client'), '#internal/nitro': resolve(ctx.nuxt.options.buildDir, 'nitro.client.mjs') }, - resolve: { - dedupe: ['vue'] - } + dedupe: ['vue'] }, build: { manifest: true,