Skip to content

Commit

Permalink
fix: Don't default to dev mode for production builds when using `vite…
Browse files Browse the repository at this point in the history
…-node` loader (#877)
  • Loading branch information
aklinker1 authored Jul 28, 2024
1 parent fb22bea commit 24cd01d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/wxt/src/core/wxt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export async function registerWxt(
inlineConfig: InlineConfig = {},
getServer?: (config: ResolvedConfig) => Promise<WxtDevServer>,
): Promise<void> {
// 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';

const hooks = createHooks<WxtHooks>();
const config = await resolveConfig(inlineConfig, command);
const server = await getServer?.(config);
Expand Down

0 comments on commit 24cd01d

Please sign in to comment.