refactor: simplify build optimizer node_env handling#14829
Merged
Conversation
|
|
sapphi-red
approved these changes
Nov 1, 2023
Member
Author
|
Hmm looks like we don't. All tests pass if I set it like this: const define = {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || config.mode),
}I suppose we don't have a lot of test for the build optimizer + lib mode. Let me try to add a test. |
patak-cat
approved these changes
Nov 1, 2023
Member
patak-cat
left a comment
There was a problem hiding this comment.
It seems the condition was wrong, this looks good to me too
Member
Author
|
I tried to add a test (in traceI'll merge it in for now then. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
We can workaround the change in
optimizer/index.tswithdefine: { 'process.env.NODE_ENV': 'process.env.NODE_ENV' }instead. (esbuild example)Also I'm not sure if the check was wrong. The comment mentioned lib builds but we were checking generic builds. I changed the condition to check lib builds instead (same as
define.ts)Additional context
What is the purpose of this pull request?