Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure process.env.NODE_ENV is stringified #6471

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { babel } from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import virtual from '@rollup/plugin-virtual';
import terser from '@rollup/plugin-terser';
import virtual from '@rollup/plugin-virtual';

const isProd = process.env.NODE_ENV === 'production';
const prodPlugins = [];
Expand All @@ -14,7 +14,7 @@ if (isProd) {
prodPlugins.push(
virtual({
'preact/debug': '',
})
}),
);
}

Expand All @@ -38,7 +38,7 @@ function bundleConfig(name, entryFile) {
replace({
preventAssignment: true,
values: {
'process.env.NODE_ENV': process.env.NODE_ENV,
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ensures it is still undefined if not provided, but it gets quoted as an inline string if it is.

},
}),
babel({
Expand Down
Loading