Environment variables can not be dead-code eliminated #2421
denis-sokolov
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like to rely on the dead code elimination in cases where the environment variables are compared against a static string. This is important for performance and also for security, where some builds of the application may include code that is not supposed to go in other builds.
This issue seems has been fixed in #2013, but I experience it again on Snowpack 3.0.11.
Source code:
Actual generated code:
Expected generated code:
Or, rather, I expect after the Webpack optimizing plugin to see the entire branch protected by the condition above gone. Instead, I see
E="xxx"===o.MODE
as a condition.Related: #1540
Beta Was this translation helpful? Give feedback.
All reactions