During production build process.env.NODE_ENV transpiles into value.
#5007
-
|
Given code like this: process.env.NODE_ENV ||= 'development';
export const x = process.env.NODE_ENV;I get the following error during production build: ● node ━━━━━━━━━━━━━━━━━━━━━━━━━ (93%) sealing after asset optimization error Build error:
× JavaScript parsing error: Cannot assign to this
╭─[37:0]
35 │ x: () => (x)
36 │ });
37 │ "production" ||= 'development';
· ────────────
38 │ const x = "production";
39 │
╰────Probably, because of optimizations. Is this a bug, or a misconfiguration? |
Beta Was this translation helpful? Give feedback.
Answered by
chenjiahan
Apr 12, 2025
Replies: 1 comment
-
|
This is the default behavior and can be customized, see: https://rsbuild.dev/guide/advanced/env-vars#processenvnode_env |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the default behavior and can be customized, see: https://rsbuild.dev/guide/advanced/env-vars#processenvnode_env