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

Define environment variables by default #38

Open
silverwind opened this issue May 31, 2020 · 1 comment
Open

Define environment variables by default #38

silverwind opened this issue May 31, 2020 · 1 comment

Comments

@silverwind
Copy link

I think it'd make sense to define everything in process.env by default, so instead of

/// #if env == 'PRODUCTION'
/// #if PRODUCTION

one can do a more standard

/// #if NODE_ENV === 'production'
/// #if process.env.NODE_ENV === 'production'

Variables defined in options should overwrite bare variables like NODE_ENV but process.env should always reflect the actual environment.

I imagine this would allow to integrate the loader with default options in most cases.

@yoursunny
Copy link

Caution: on Windows, there are default environment variable names that contain ( character, such as ProgramFiles(x86).
If they are defined as part of options by default, it will cause error on this line:

const f = new Function(...args, code);

See kenpb/parcel-plugin-ifdef#2 for more information.

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

2 participants