Skip to content

Commit c7e6a91

Browse files
authored
fix: Fix define stringify in build (#996)
After #981 I got an error: > ▲ [WARNING] "process.env.NODE_ENV" is defined as an identifier instead of a string (surround "development" with quotes to get a string) [suspicious-define] According to chatgpt: > The define option replaces expressions at build time, so it’s a literal text substitution. That means you must pass a valid JS expression as a string, not an identifier. Therefore we need to pass `JSON.stringify` into the input.
1 parent 7275a82 commit c7e6a91

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

build.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const node_env = process.env.NODE_ENV || "production";
1515
const defineEnv = {
1616
// Ref https://github.com/manzt/anywidget/issues/369#issuecomment-1792376003
1717
"define.amd": "false",
18-
"process.env.NODE_ENV": node_env,
18+
"process.env.NODE_ENV": JSON.stringify(node_env),
1919
"process.env.XSTATE_INSPECT": JSON.stringify(
2020
process.env.XSTATE_INSPECT || "false",
2121
),

0 commit comments

Comments
 (0)