-
Notifications
You must be signed in to change notification settings - Fork 44
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
fix: create same hashes on server and client #1976
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
we saw a behaviour with dynamic imports for SSR, when the import was directly referenced, e.g. with `import(./foo')` instead of `import('./')` webpack would with create different filehashes in the moduleMap when the option `usedExports` is enabled. filenames before hashing in webpack with `usedExports` followed the pattern: `filename.js|abc` filenames without `usedExports` are simply the filename: `filename.js` they are then hashed in webpacks `HashedModuleIdsPlugin.js` with different results, leading to an incomplete modulesMap Co-authored-by: Jonas Holland <jonas.holland@new-work.se>
4 tasks
robertkowalski
added
the
📦 master
Apply this label to a pull request, if it has to be cherry-picked to the maste-branch.
label
Sep 29, 2021
jhiode
approved these changes
Sep 29, 2021
build size increases 150KB, but is still smaller than the previous fix with named module ids |
bors merge |
bors bot
added a commit
that referenced
this pull request
Sep 29, 2021
1976: fix: create same hashes on server and client r=robertkowalski a=robertkowalski we saw a behaviour with dynamic imports for SSR, when the import was directly referenced, e.g. with `import(./foo')` instead of `import('./')` webpack would with create different filehashes in the moduleMap when the option `usedExports` is enabled. filenames before hashing in webpack with `usedExports` followed the pattern: `filename.js|abc` filenames without `usedExports` are simply the filename: `filename.js` they are then hashed in webpacks `HashedModuleIdsPlugin.js` with different results, leading to an incomplete modulesMap Co-authored-by: Jonas Holland <jonas.holland@new-work.se> This pull request closes issue # (_put the issue number here_) <!-- This is a template. Feel free to remove the parts you do not need! Start with this line, for example --> ## Current state <!-- explanation of the current state --> ## Changes introduced here <!-- explanation of the changes you did in this pull request --> ## Checklist - [ ] All commit messages adhere to the [appropriate format](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit) in order to trigger a correct release - [ ] All code is written in untranspiled ECMAScript (ES 2017) and is formatted using [prettier](https://prettier.io) - [ ] Necessary unit tests are added in order to ensure correct behavior - [ ] Documentation has been added <details> <summary>Bors merge bot cheat sheet</summary> We are using [bors-ng](https://github.com/bors-ng/bors-ng) to automate merging of our pull requests. The following table provides a summary of commands that are available to reviewers (members of this repository with push access) and delegates (in case of `bors delegate+` or `bors delegate=[list]`). | Syntax | Description | | --- | --- | | bors merge | Run the test suite and push to master if it passes. Short for "reviewed: looks good." | | bors merge- | Cancel an r+, r=, merge, or merge= | | bors try | Run the test suite without pushing to master. | | bors try- | Cancel a try | | bors delegate+ | Allow the pull request author to merge their changes. | | bors delegate=[list] | Allow the listed users to r+ this pull request's changes. | | bors retry | Run the previous command a second time. | This is a short collection of opinionated commands. For a full list of the commands read the [bors reference](https://bors.tech/documentation/). </details> Co-authored-by: Robert Kowalski <robert.kowalski@new-work.se>
Timed out. |
all green, only bors timed out (also in bors merge) -- lets fix bors after the release. |
ZauberNerd
added a commit
that referenced
this pull request
Jan 31, 2022
We observed that in some cases the generated module ids differe between the browser and server build. This happens when one of the builds is able to concatenate modules into one chunk while the other build can't (e.g. because the modules live in different chunks because of code splitting). Because we did not want to split the server build into chunks and then load them manually, we decided to generate stable chunk names, that do not differ between browser/server, in our importComponent babel plugin. We tried to work around this issue previously via #1976 but with a later webpack version our workaround stopped working. Furthermore, our previous workaround had other issues, which impacted tree-shaking and therefore the bundle size. Co-authored-by: Markus Wolf <markus.wolf@new-work.se> Co-authored-by: Philipp Hinrichsen <philipp.hinrichsen@new-work.se> Co-authored-by: Robert Kowalski <robert.kowalski@new-work.se>
ZauberNerd
added a commit
that referenced
this pull request
Feb 2, 2022
We observed that in some cases the generated module ids differe between the browser and server build. This happens when one of the builds is able to concatenate modules into one chunk while the other build can't (e.g. because the modules live in different chunks because of code splitting). Because we did not want to split the server build into chunks and then load them manually, we decided to generate stable chunk names, that do not differ between browser/server, in our importComponent babel plugin. We tried to work around this issue previously via #1976 but with a later webpack version our workaround stopped working. Furthermore, our previous workaround had other issues, which impacted tree-shaking and therefore the bundle size. Co-authored-by: Markus Wolf <markus.wolf@new-work.se> Co-authored-by: Philipp Hinrichsen <philipp.hinrichsen@new-work.se> Co-authored-by: Robert Kowalski <robert.kowalski@new-work.se>
ZauberNerd
added a commit
that referenced
this pull request
Feb 2, 2022
We observed that in some cases the generated module ids differe between the browser and server build. This happens when one of the builds is able to concatenate modules into one chunk while the other build can't (e.g. because the modules live in different chunks because of code splitting). Because we did not want to split the server build into chunks and then load them manually, we decided to generate stable chunk names, that do not differ between browser/server, in our importComponent babel plugin. We tried to work around this issue previously via #1976 but with a later webpack version our workaround stopped working. Furthermore, our previous workaround had other issues, which impacted tree-shaking and therefore the bundle size. Co-authored-by: Markus Wolf <markus.wolf@new-work.se> Co-authored-by: Philipp Hinrichsen <philipp.hinrichsen@new-work.se> Co-authored-by: Robert Kowalski <robert.kowalski@new-work.se>
bors bot
added a commit
that referenced
this pull request
Feb 16, 2022
2070: Fix `importComponent` r=ZauberNerd a=ZauberNerd Ref: #1632, #1976 Todo: - [x] What happens if we import the same file from different files? I suspect our babel plugin will generate different chunk names which should in fact not be different. So maybe our hash should not include the filepath of the importing component but only the filepath of the imported component. - seems to create separate entries in the `namedChunkGroups` which point to the same asset. <details> <summary>Bors merge bot cheat sheet</summary> We are using [bors-ng](https://github.com/bors-ng/bors-ng) to automate merging of our pull requests. The following table provides a summary of commands that are available to reviewers (members of this repository with push access) and delegates (in case of `bors delegate+` or `bors delegate=[list]`). | Syntax | Description | | --- | --- | | bors merge | Run the test suite and push to master if it passes. Short for "reviewed: looks good." | | bors merge- | Cancel an r+, r=, merge, or merge= | | bors try | Run the test suite without pushing to master. | | bors try- | Cancel a try | | bors delegate+ | Allow the pull request author to merge their changes. | | bors delegate=[list] | Allow the listed users to r+ this pull request's changes. | | bors retry | Run the previous command a second time. | This is a short collection of opinionated commands. For a full list of the commands read the [bors reference](https://bors.tech/documentation/). </details> Co-authored-by: Björn Brauer <bjoern.brauer@new-work.se> Co-authored-by: Robert Kowalski <robert.kowalski@new-work.se>
1 task
ZauberNerd
added a commit
that referenced
this pull request
Feb 16, 2022
We observed that in some cases the generated module ids differe between the browser and server build. This happens when one of the builds is able to concatenate modules into one chunk while the other build can't (e.g. because the modules live in different chunks because of code splitting). Because we did not want to split the server build into chunks and then load them manually, we decided to generate stable chunk names, that do not differ between browser/server, in our importComponent babel plugin. We tried to work around this issue previously via #1976 but with a later webpack version our workaround stopped working. Furthermore, our previous workaround had other issues, which impacted tree-shaking and therefore the bundle size. Co-authored-by: Markus Wolf <markus.wolf@new-work.se> Co-authored-by: Philipp Hinrichsen <philipp.hinrichsen@new-work.se> Co-authored-by: Robert Kowalski <robert.kowalski@new-work.se>
ZauberNerd
added a commit
that referenced
this pull request
Feb 16, 2022
We observed that in some cases the generated module ids differe between the browser and server build. This happens when one of the builds is able to concatenate modules into one chunk while the other build can't (e.g. because the modules live in different chunks because of code splitting). Because we did not want to split the server build into chunks and then load them manually, we decided to generate stable chunk names, that do not differ between browser/server, in our importComponent babel plugin. We tried to work around this issue previously via #1976 but with a later webpack version our workaround stopped working. Furthermore, our previous workaround had other issues, which impacted tree-shaking and therefore the bundle size. Co-authored-by: Markus Wolf <markus.wolf@new-work.se> Co-authored-by: Philipp Hinrichsen <philipp.hinrichsen@new-work.se> Co-authored-by: Robert Kowalski <robert.kowalski@new-work.se>
ZauberNerd
added a commit
that referenced
this pull request
Feb 16, 2022
We observed that in some cases the generated module ids differe between the browser and server build. This happens when one of the builds is able to concatenate modules into one chunk while the other build can't (e.g. because the modules live in different chunks because of code splitting). Because we did not want to split the server build into chunks and then load them manually, we decided to generate stable chunk names, that do not differ between browser/server, in our importComponent babel plugin. We tried to work around this issue previously via #1976 but with a later webpack version our workaround stopped working. Furthermore, our previous workaround had other issues, which impacted tree-shaking and therefore the bundle size. Co-authored-by: Markus Wolf <markus.wolf@new-work.se> Co-authored-by: Philipp Hinrichsen <philipp.hinrichsen@new-work.se> Co-authored-by: Robert Kowalski <robert.kowalski@new-work.se>
ZauberNerd
added a commit
that referenced
this pull request
Feb 16, 2022
We observed that in some cases the generated module ids differe between the browser and server build. This happens when one of the builds is able to concatenate modules into one chunk while the other build can't (e.g. because the modules live in different chunks because of code splitting). Because we did not want to split the server build into chunks and then load them manually, we decided to generate stable chunk names, that do not differ between browser/server, in our importComponent babel plugin. We tried to work around this issue previously via #1976 but with a later webpack version our workaround stopped working. Furthermore, our previous workaround had other issues, which impacted tree-shaking and therefore the bundle size. Co-authored-by: Markus Wolf <markus.wolf@new-work.se> Co-authored-by: Philipp Hinrichsen <philipp.hinrichsen@new-work.se> Co-authored-by: Robert Kowalski <robert.kowalski@new-work.se>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
📦 master
Apply this label to a pull request, if it has to be cherry-picked to the maste-branch.
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.
we saw a behaviour with dynamic imports for SSR, when the import
was directly referenced, e.g. with
import(./foo')
instead ofimport('./')
webpack would with create different filehashes inthe moduleMap when the option
usedExports
is enabled.filenames before hashing in webpack with
usedExports
followed thepattern:
filename.js|abc
filenames without
usedExports
are simply the filename:filename.js
they are then hashed in webpacks
HashedModuleIdsPlugin.js
withdifferent results, leading to an incomplete modulesMap
Co-authored-by: Jonas Holland jonas.holland@new-work.se
This pull request closes issue # (put the issue number here)
Current state
Changes introduced here
Checklist
Bors merge bot cheat sheet
We are using bors-ng to automate merging of our pull requests. The following table provides a summary of commands that are available to reviewers (members of this repository with push access) and delegates (in case of
bors delegate+
orbors delegate=[list]
).This is a short collection of opinionated commands. For a full list of the commands read the bors reference.