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

Inserted identifier clashes with existing one #1818

Closed
Andarist opened this issue Mar 23, 2020 · 3 comments
Closed

Inserted identifier clashes with existing one #1818

Andarist opened this issue Mar 23, 2020 · 3 comments
Labels

Comments

@Andarist
Copy link
Member

Originally reported by @zslabs in #1751, but I've managed to slim it down to a minimal repro. The key to reproduce the error is to crawl the scope before our plugin.

I don't intend to fix this right away as it might not be trivial and the issue also happens with Babel's core plugins (tested on the newly introduced automatic mode of React's preset). I've reported it over there to see how it plays out, hopefully we'll benefit here from their fix 🤞 Reporting the issue in here right now, just so it doesn't get lost.

require('@babel/core').transform(`

import _css from "@emotion/css";

const Header = () => {
  var _css2;

  return _css((_css2 = {}, _css2[Math.random()] = {color: 'hotpink'}, _css2))
};

export default Header;

`, {
  plugins: [
    [api => ({ visitor: { Program(p) { p.scope.crawl() } } })],
    'babel-plugin-emotion'
  ]
}).code
@Andarist Andarist added the bug label Mar 23, 2020
@zslabs
Copy link
Contributor

zslabs commented Mar 23, 2020

Thanks for creating this @Andarist! Do you have a link handy to the Babel issue you created? Ah found it! babel/babel#11320

@Andarist
Copy link
Member Author

Andarist commented Mar 24, 2020

The fix has landed in Babel and should be available in its next release: babel/babel#11323

@zslabs
Copy link
Contributor

zslabs commented Mar 24, 2020

Thank you very much @Andarist for going down the rabbit-hole with this one! 🙌

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

No branches or pull requests

2 participants