From 655ba863a0399247c2b76d41f0a70442bd0c8cb9 Mon Sep 17 00:00:00 2001 From: Alec Larson <1925840+aleclarson@users.noreply.github.com> Date: Wed, 12 Feb 2025 00:44:29 -0500 Subject: [PATCH] fix: respect `inlineConfig.mode` when setting NODE_ENV (#1416) --- packages/wxt/src/core/wxt.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/wxt/src/core/wxt.ts b/packages/wxt/src/core/wxt.ts index 2c616b75..eafc9429 100644 --- a/packages/wxt/src/core/wxt.ts +++ b/packages/wxt/src/core/wxt.ts @@ -21,7 +21,8 @@ export async function registerWxt( ): Promise { // Default NODE_ENV environment variable before other packages, like vite, do it // See https://github.com/wxt-dev/wxt/issues/873#issuecomment-2254555523 - process.env.NODE_ENV ??= command === 'serve' ? 'development' : 'production'; + process.env.NODE_ENV ??= + inlineConfig.mode ?? (command === 'serve' ? 'development' : 'production'); const hooks = createHooks(); const config = await resolveConfig(inlineConfig, command);