-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 inconsistent hashes using development vs production bundles/exports
conditions
#3270
base: main
Are you sure you want to change the base?
Conversation
🦋 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. |
'@emotion/serialize': patch | ||
'@emotion/styled': patch | ||
'@emotion/cache': patch | ||
'@emotion/utils': patch | ||
'@emotion/css': patch | ||
'@emotion/react': patch | ||
'@emotion/babel-plugin': patch |
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.
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.
if (isDevelopment) { | ||
styles = styles.replace(sourceMapPattern!, match => { | ||
sourceMap = match | ||
return '' | ||
}) | ||
} |
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 is the actual part that makes the hashes consistent
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.