Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Use v11 of emotion babel plugin #4303

Merged
merged 8 commits into from
Feb 4, 2021
Merged

Conversation

ryanmccombe
Copy link
Contributor

@ryanmccombe ryanmccombe commented Feb 4, 2021

Resolves [No Issue]

Overall change:
The babel plugin emotion refers to https://www.npmjs.com/package/babel-plugin-emotion
As of v11, we should be using @emotion which refers to https://www.npmjs.com/package/@emotion/babel-plugin

@emotion/babel-plugin does seem to have been correctly added to package.json, and babel-plugin-emotion was correctly removed, however, without this change to the .babelrc the psammead packages were still compiled using the old babel-plugin-emotion

Normally attempting to use a plugin that was not installed would have thrown an error, however, the old plugin was still available, as it was a transitive dependency of react-select which is used by storybook

The effect of having emotion 11 components in Psammead, compiled with an Emotion 10 plugin, then imported into Simorgh and recompiled with an emotion 11 plugin is almost certainly causing the issues we were seeing

Manual, local compilation using this babel config, and then importing of these Psammead packages into a local Simorgh does seem to indicate this is the solution to the problem. However, applying this fix properly will require a version bump and republish of every Psammead package again

Code changes:

  • Update babel config to correctly use emotion plugin.
  • Bump everything to trigger rebuilds under new config.
  • Update storybook webpack config to let it work with emotion 11.
  • Update two components that output invalid CSS when a boolean is false.

  • I have assigned myself to this PR and the corresponding issues
  • Automated jest tests added (for new features) or updated (for existing features)
  • This PR requires manual testing

CHANGELOG.md Outdated Show resolved Hide resolved
@ryanmccombe ryanmccombe self-assigned this Feb 4, 2021
@ryanmccombe ryanmccombe added the cross-team For visibility for both World Service teams (Engage & Media) label Feb 4, 2021
simonsinclair
simonsinclair previously approved these changes Feb 4, 2021
joshcoventry
joshcoventry previously approved these changes Feb 4, 2021
@ryanmccombe ryanmccombe dismissed stale reviews from joshcoventry and simonsinclair February 4, 2021 11:31

Dismissing reviews as this PR has totally changed

@ryanmccombe ryanmccombe changed the title Use Emotion 11 Babel Plugin Correctly Use v11 of emotion babel plugin Feb 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cross-team For visibility for both World Service teams (Engage & Media)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants