From e5b708f8a48b9e577c2f7046eace065b8404ea3d Mon Sep 17 00:00:00 2001 From: Vladimir Date: Fri, 18 Feb 2022 09:31:39 +0300 Subject: [PATCH] fix: don't remove user defines --- packages/vitest/src/node/plugins/index.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/packages/vitest/src/node/plugins/index.ts b/packages/vitest/src/node/plugins/index.ts index da461cb54984..7ecee6e57576 100644 --- a/packages/vitest/src/node/plugins/index.ts +++ b/packages/vitest/src/node/plugins/index.ts @@ -92,16 +92,6 @@ export async function VitestPlugin(options: UserConfig = {}, ctx = new Vitest()) ) options.api = resolveApiConfig(options) - // we cannot replace them, because esbuild will throw an error, - // so we are removing them to allow reassigning - const define = viteConfig.define - - if (define) { - delete define['process.env.NODE_ENV'] - delete define['global.process.env.NODE_ENV'] - delete define['globalThis.process.env.NODE_ENV'] - } - // we replace every "import.meta.env" with "process.env" // to allow reassigning, so we need to put all envs on process.env const { PROD, DEV, ...envs } = viteConfig.env