Define environment variables by default
Opened this issue · 1 comments
silverwind commented
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 commented
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:
Line 209 in 5018e64
See kenpb/parcel-plugin-ifdef#2 for more information.