Fix inconsistent hashes using development vs production bundles/exports conditions#3270
Merged
Fix inconsistent hashes using development vs production bundles/exports conditions#3270
exports conditions#3270Conversation
🦋 Changeset detectedLatest commit: 0398290 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
emmatown
commented
Nov 13, 2024
Comment on lines
+2
to
+8
| '@emotion/serialize': patch | ||
| '@emotion/styled': patch | ||
| '@emotion/cache': patch | ||
| '@emotion/utils': patch | ||
| '@emotion/css': patch | ||
| '@emotion/react': patch | ||
| '@emotion/babel-plugin': patch |
Member
Author
There was a problem hiding this comment.
I'm releasing extra packages than necessary just so people can more easily can bump the thing they directly depend on rather than refreshing whole lock files.
emmatown
commented
Nov 13, 2024
Comment on lines
-434
to
-439
| if (isDevelopment) { | ||
| styles = styles.replace(sourceMapPattern!, match => { | ||
| sourceMap = match | ||
| return '' | ||
| }) | ||
| } |
Member
Author
There was a problem hiding this comment.
This is the actual part that makes the hashes consistent
Merged
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.
Fixes #3222
Arguably this isn't really a bug in Emotion since tools like Next should use the conditions on external code correctly (it works correctly with the App Router since they bundle everything) but the reality is like this and the fix makes it less complex anyway imo.
This will sort of "break" source maps in older versions of the babel plugin with new versions of the runtime and vice versa but since it's only breaking source maps, I think that's fine.
Also, I checked the swc emotion plugin and it doesn't seem to do the particular optimisations that the Babel plugin does so it doesn't need to change.