-
Notifications
You must be signed in to change notification settings - Fork 516
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
chore(webpack): simplify our webpack config #11099
Merged
Merged
Conversation
This file contains 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
found through much testing, setting chunkIds and moduleIds to "deterministic" (which is the default in production) results in undeterministic behavior when making changes to the webpack config which don't result in any changes to the inherent content of processed files this seems to be because "deterministic" uses metadata about all configured module loaders there are in the webpack config when calculating the hash, so if you remove a loader which isn't doing anything, that change still results in a change to the module and chunk ids instead, using either "named" or "natural" ensures that such changes don't result in any changes to the webpack output this allows easy verification that modifications to the webpack config haven't changed any output with a simple diff
we don't use it due to our CSP
image/avif has been in mime-db since 2020: https://github.com/jshttp/mime-db/blob/master/HISTORY.md#1450--2020-09-22
use defaults for cache locations
remove checks that abort the build if this file doesn't exist - the build fails anyway if this or the appHtml path doesn't exist
argl
reviewed
May 10, 2024
Comment on lines
-332
to
-333
// TODO: Merge this config once `image/avif` is in the mime-db | ||
// https://github.com/jshttp/mime-db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So satisfactory when a long game finally resolves!
argl
approved these changes
May 10, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Successfully tested locally, astonishing amount of cruft removed.
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.
Summary
https://mozilla-hub.atlassian.net/browse/MP-1132
Problem
As a result of using create react app, our webpack config is over complicated.
Solution
Begin simplifying it. None of these changes aside from the first commit should make a difference to our build output, which can be verified following the instructions in the section below.
chore(webpack): deterministic output when changing config does make a change to our build output, but this is to ensure the other changes don't. A full explanation is in the commit message, but the summary is that due to internal webpack naming logic, changes to the webpack config which shouldn't have made any difference were changing the computed names for modules and chunks.
How did you test this change?
Checkout chore(webpack): deterministic output when changing config, and build the client, moving the assets into another folder:
We now effectively have the webpack output from
main
, plus the changes in chore(webpack): deterministic output when changing config necessary to ensure changes to webpack which don't change the output actually don't change the output (due to the aforementioned internal webpack naming logic). Now checkout this PR and build it:The diff should exit with no output, showing the webpack output hasn't changed.