chore: FIT-14: Fix webpack build for standalone apps #7596
Merged
+3
−3
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.
This pull request updates the
webpack.config.js
file to handle cases where theMODE
environment variable might be undefined. The changes ensure safer access toprocess.env.MODE
by using optional chaining (?.
).Improvements to environment variable handling:
optimizer
function to useprocess.env.MODE?.startsWith("standalone")
, preventing potential runtime errors ifMODE
is undefined. ([web/webpack.config.jsL68-R68](https://github.com/HumanSignal/label-studio/pull/7596/files#diff-1ace8d4ea714744aae05de2cab449346ded75cf8646e36fcd8eb5d1cd66f4d03L68-R68)
)composePlugins
section to safely check ifprocess.env.MODE
starts with "standalone" using optional chaining. ([web/webpack.config.jsL87-R87](https://github.com/HumanSignal/label-studio/pull/7596/files#diff-1ace8d4ea714744aae05de2cab449346ded75cf8646e36fcd8eb5d1cd66f4d03L87-R87)
)devServer
configuration to use optional chaining for theprocess.env.MODE.startsWith("standalone")
condition, ensuring robust handling of undefined values. ([web/webpack.config.jsL273-R273](https://github.com/HumanSignal/label-studio/pull/7596/files#diff-1ace8d4ea714744aae05de2cab449346ded75cf8646e36fcd8eb5d1cd66f4d03L273-R273)
)