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

accommodate Vite tomfoolery #955

Open
JThompson-VI opened this issue Mar 5, 2025 · 0 comments
Open

accommodate Vite tomfoolery #955

JThompson-VI opened this issue Mar 5, 2025 · 0 comments

Comments

@JThompson-VI
Copy link

JThompson-VI commented Mar 5, 2025

First off thank you for maintaining such a great project, and I 100% understand if you don't want this change.

During the building of a Vite project it replaces instances of the code 'process.env.NODE_ENV' with the literal '"production"' this causes a syntax error in the isDev function in lib/utils/index.js as it calls global.process.env.NODE_ENV. If this code were changed to global.process.env['NODE_ENV'] it would work with vite.

diff --git a/lib/utils/index.js b/lib/utils/index.js
index 832dde65..116874e6 100644
--- a/lib/utils/index.js
+++ b/lib/utils/index.js
@@ -31,7 +31,7 @@ function isText(txt) {
 // Proper configuration is having NODE_ENV = 'development', but this
 // method only checks for 'dev' being present, and regardless of the case.
 function isDev() {
-    const env = global.process.env.NODE_ENV || '';
+    const env = global.process.env[`NODE_ENV`] || '';
     return env.toLowerCase().indexOf('dev') !== -1;
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant