generated from MetaMask/metamask-module-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Problem
packages/cli/src/vite/vat-bundler.ts hardcodes a define block that replaces process.env.NODE_ENV with "production" in all vat bundles:
define: {
'process.env.NODE_ENV': JSON.stringify('production'),
},This is a workaround for libraries like immer that check process.env.NODE_ENV, but it injects into all bundles indiscriminately. The vat bundler shouldn't be responsible for shimming environment globals.
Proposed solution
Configure Vite (via a plugin or the Vite config used at build time) to inject globals like process.env.NODE_ENV, and remove this define block from the vat bundler. This keeps the bundler focused on bundling and moves environment concerns to the build configuration layer where they belong.
Location
packages/cli/src/vite/vat-bundler.ts(lines 23-28)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels