Skip to content
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

Document CSS prop incompatibility with babel-plugin-transform-react-inline-elements #348

Merged
merged 1 commit into from
Sep 26, 2017

Conversation

apostolos
Copy link
Contributor

What:
transform-react-inline-elements breaks CSS prop.

The plugin order is complicated because babel plugins don’t run one after the other, they run at the same time, so you have a JSXElement (babel-plugin-transform-react-inline-elements does it’s stuff here) and a JSXOpeningElement (where the css prop stuff runs), the JSXElement will be visited and the plugins that visit that node will run in the order they’re specified in the babel config and if the JSXElement is replaced there the JSXOpeningElement never gets visited.

Why:
This behavior should be documented. babel-plugin-transform-react-inline-elements is usually only included in production, therefore it's highly likely that someone might use CSS prop in development thinking it is working fine. But as soon as they compile the project for production styles will silently fail.

Checklist:

  • Documentation
  • Tests N/A
  • Code complete N/A

@codecov
Copy link

codecov bot commented Sep 26, 2017

Codecov Report

Merging #348 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #348   +/-   ##
=======================================
  Coverage   97.36%   97.36%           
=======================================
  Files          17       17           
  Lines         569      569           
  Branches      134      134           
=======================================
  Hits          554      554           
  Misses         11       11           
  Partials        4        4

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 60b4486...b5537cd. Read the comment docs.

@tkh44 tkh44 merged commit 243fcba into emotion-js:master Sep 26, 2017
@tkh44
Copy link
Member

tkh44 commented Sep 26, 2017

Thank you @apostolos

@GuillaumeCisco
Copy link

Is there a way to get both working?
We got the issue in our production environment as babel-plugin-transform-react-inline-elements was included only in production.
Furthermore, the migrating documentation from 9 to 10 should heavily warn about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants