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

Fix @babel/transform-typescript compatibility with Next.js #14610

Merged

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented May 27, 2022

Q                       A
Fixed Issues? Fixes vercel/next.js#37080
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

This was a quite annoying discovery, I'm pasting here the comment I also wrote in the code:

We use api.types.* and not t.* (imported from @babel/core) for feature detection,
because the Babel version that is running this plugin
(where we check if the visitor is valid) might be different
from the Babel version that we resolve with import "@babel/core".
This happens, for example, with Next.js that bundled @babel/core
but allows loading unbundled plugin (which cannot obviously import
the bundled @babel/core version).

I verified that this works using #14587 (comment).

@nicolo-ribaudo nicolo-ribaudo added PR: Bug Fix 🐛 A type of pull request used for our changelog categories area: typescript i: regression labels May 27, 2022
@babel-bot
Copy link
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/52059/

@nicolo-ribaudo nicolo-ribaudo merged commit 6d59ed7 into babel:main May 29, 2022
@nicolo-ribaudo nicolo-ribaudo deleted the fix-plugin-ts-7.18-compat-with-next branch May 29, 2022 16:20
@nicolo-ribaudo
Copy link
Member Author

I'll release this in a few hours.

@tjbp
Copy link

tjbp commented Jun 3, 2022

@nicolo-ribaudo has this release been published to NPM? Am having the same problem reported in vercel/next.js#37080 but in a VueJS app, though the latest release available is still 7.18.2. Thanks!

@nicolo-ribaudo
Copy link
Member Author

Yes, in @babel/plugin-transform-typescript 7.18.4

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Sep 3, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: typescript i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Babel error causing builds to fail
5 participants