-
Notifications
You must be signed in to change notification settings - Fork 10.3k
breaking(gatsby-plugin-emotion): update to emotion@11 #27981
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
Conversation
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.
Thanks for the update! I don't think it's critical ;) as peer deps still hold on to the old versions.
Could you update our examples as well:
looking forward to this update to emotion@11 |
@wardpeet yes thats a good idea. thanks for your help. it seems I have tests failing still =[ When reviewing this PR please also check:https://emotion.sh/docs/emotion-11 - this has all the package renaming && looking at babel-preset-css-prop https://emotion.sh/docs/@emotion/babel-preset-css-prop
conclusionIt looks like there is more work that can be done here to improve this gatsby plugin. However I am afraid I do not quite understand whats going on in gatsby-node.js for this plugin. I might have bitten off more than I can chew here. |
@theskillwithin - there seems to be a lot of places where you need to replace the following:
But I think the reason why the test is failing is because emotion v11 changed So you need to update from: exports.pluginOptionsSchema = ({ Joi }) =>
Joi.object({
...
autoLabel: Joi.boolean()
.default(process.env.NODE_ENV !== `production`)
.description(
`This option automatically adds the label property to styles so that class names generated by css or styled include the name of the variable the result is assigned to. You can read more about this option in babel-plugin-emotion's docs: https://emotion.sh/docs/babel-plugin-emotion#autolabel`
),
...
}) to: exports.pluginOptionsSchema = ({ Joi }) =>
Joi.object({
...
autoLabel: Joi.string()
.default(`dev-only`)
.description(
`This option automatically adds the label property to styles so that class names generated by css or styled include the name of the variable the result is assigned to. You can read more about this option in @emotion/babel-plugin's docs: https://emotion.sh/docs/@emotion/babel-plugin#autolabel`
),
...
}) I created a PR on your fork of gatsby repo with the remaining changes (https://github.com/theskillwithin/gatsby/pull/1). |
in emotion v11: - @emotion/core → @emotion/react - emotion-theming → moved into @emotion/react - babel-plugin-emotion → @emotion/babel-plugin - jest-emotion → @emotion/jest update gatsby-plugin-emotion's autoLabel option from boolean to string to reflect breaking changes in emotion v11.
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.
Awesome! This looks great, I'll test it out!
Thank you and congrats on your first contribution! 🎉
@ward It seems like the changes in https://github.com/theskillwithin/gatsby/pull/1 should also be incorporated |
update gatsby-plugin-emotion, gatsby docs, and packages references to emotion v11
now merged but checks failing |
@jHards - sorry, the ci/circleci: bootstrap is failing because I edited |
all checks have passed! |
the build failed during integration testing. Not sure what is the cause since the code hasn't changed since the last build. I tried to resolve merge conflict, but the build failed. So I reverted my changes, but the build is still failing... FAIL __tests__/develop.js (10.24s)
● gatsby develop › starts a gatsby site on port 8000
Command failed with exit code 1: /tmp/gatsby-cli-QNNnyx/node_modules/.bin/gatsby develop
internal/modules/cjs/loader.js:582
throw err;
^
Error: Cannot find module '/home/circleci/project/integration-tests/gatsby-cli/gatsby-sites/gatsby-develop/.cache/tmp-1699-D13C9Oh9Bssz'
internal/modules/cjs/loader.js:582
throw err;
^
Error: Cannot find module '/home/circleci/project/integration-tests/gatsby-cli/gatsby-sites/gatsby-develop/.cache/tmp-1699-FaeQMKUq5j9K'
at makeError (integration-tests/gatsby-cli/node_modules/execa/lib/error.js:59:11)
at handlePromise (integration-tests/gatsby-cli/node_modules/execa/index.js:114:26) |
merge master
This appears to be blocking the completion of Tutorial part 4 (and also 5) on the Gatsby website. Is there a temporary work around? |
whats going on here? |
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.
Tested and works great! 🙏 Thank you!
Upgrade
gatsby-plugin-emotion
package to use the new@emotion/react
dep.with new emotion update, this package no longer works unless these deps are upgraded
Fixes #28063