fix: Don't default to dev mode for production builds when using vite-node loader (#877)

This commit is contained in:
Aaron
2024-07-28 10:45:32 -05:00
committed by GitHub
parent fb22beadb8
commit 24cd01dd31
+4
View File
@@ -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);