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

Babel plugin doesn't add PURE comment in latests babel #2619

Closed
paul-sachs opened this issue Jan 19, 2022 · 4 comments · Fixed by #2799
Closed

Babel plugin doesn't add PURE comment in latests babel #2619

paul-sachs opened this issue Jan 19, 2022 · 4 comments · Fixed by #2799
Assignees
Labels

Comments

@paul-sachs
Copy link

Current behavior:

The current babel plugin seems to work fine for everything except the /* #PURE */ comment that should be seen.

To reproduce:

  1. See custom repo: https://github.com/paul-sachs/emotion-babel-bug
  2. Run npm install and npm run build
  3. Output will not have PURE comment prefixed to styled component

Expected behavior:

All styled blocks should be prefixed with PURE comment

Environment information:

  • "react": "^17.0.2",
  • "@emotion/babel-plugin": "^11.7.2"
  • "@emotion/core": "^11.0.0",
  • "@emotion/styled": "^11.6.0",
@srmagura
Copy link
Member

srmagura commented Jan 19, 2022

Thanks for the report. It's odd, the line that adds the PURE comment is getting hit, but the comment is not actually getting added. I can look at this over the weekend, though I'm not sure if I can fix it.

BTW, @emotion/core is deprecated and currently does nothing.

@paul-sachs
Copy link
Author

paul-sachs commented Jan 19, 2022 via email

@srmagura
Copy link
Member

Awesome. @Andarist is that the correct solution?

@Andarist
Copy link
Member

It might be the correct solution but that also means that something has changed on the Babel side of things. In general, comments are really wonky in AST because based on a source file it's really uncertain to which AST node a particular comment belongs. So perhaps the Babel generator (from AST to text) changes its logic somehow and what we have been adding became swallowed now?

We should upgrade all Babel deps and check if any of our snapshots change.

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