From 8d81f30c99472fe8748f86f039fd70d886c6ee3e Mon Sep 17 00:00:00 2001 From: Cristopher Namchee Date: Mon, 13 Nov 2023 21:16:08 +0700 Subject: [PATCH 1/2] fix(plugin): disable esbuild if user config sets it to false --- packages/vitest/src/node/plugins/index.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/vitest/src/node/plugins/index.ts b/packages/vitest/src/node/plugins/index.ts index 2bc983aadb5a..0df21fadde00 100644 --- a/packages/vitest/src/node/plugins/index.ts +++ b/packages/vitest/src/node/plugins/index.ts @@ -64,12 +64,15 @@ export async function VitestPlugin(options: UserConfig = {}, ctx = new Vitest('t const config: ViteConfig = { root: viteConfig.test?.root || options.root, - esbuild: { - sourcemap: 'external', - - // Enables using ignore hint for coverage providers with @preserve keyword - legalComments: 'inline', - }, + esbuild: viteConfig.esbuild === false + ? false + : { + ...viteConfig.esbuild, + sourcemap: 'external', + + // Enables using ignore hint for coverage providers with @preserve keyword + legalComments: 'inline', + }, resolve: { // by default Vite resolves `module` field, which not always a native ESM module // setting this option can bypass that and fallback to cjs version From ccc92416aa0ba66932544ec92abd055a2f79df07 Mon Sep 17 00:00:00 2001 From: Cristopher Namchee Date: Mon, 13 Nov 2023 21:46:21 +0700 Subject: [PATCH 2/2] fix(plugin): do not merge config --- packages/vitest/src/node/plugins/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/vitest/src/node/plugins/index.ts b/packages/vitest/src/node/plugins/index.ts index 0df21fadde00..6ffeabc06572 100644 --- a/packages/vitest/src/node/plugins/index.ts +++ b/packages/vitest/src/node/plugins/index.ts @@ -67,7 +67,6 @@ export async function VitestPlugin(options: UserConfig = {}, ctx = new Vitest('t esbuild: viteConfig.esbuild === false ? false : { - ...viteConfig.esbuild, sourcemap: 'external', // Enables using ignore hint for coverage providers with @preserve keyword