From d131fd6411391685d17a5fe72c07b61bdc3c5f84 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Fri, 11 Oct 2024 17:45:54 +0200 Subject: [PATCH] fix(browser): don't override the esbuild option in the browser mode (#6692) --- packages/browser/src/node/plugin.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/browser/src/node/plugin.ts b/packages/browser/src/node/plugin.ts index de8e8e0134d8..a0eca4c3d1a0 100644 --- a/packages/browser/src/node/plugin.ts +++ b/packages/browser/src/node/plugin.ts @@ -323,8 +323,10 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => { enforce: 'post', async config(viteConfig) { // Enables using ignore hint for coverage providers with @preserve keyword - viteConfig.esbuild ||= {} - viteConfig.esbuild.legalComments = 'inline' + if (viteConfig.esbuild !== false) { + viteConfig.esbuild ||= {} + viteConfig.esbuild.legalComments = 'inline' + } const server = resolveApiServerConfig( viteConfig.test?.browser || {},