diff --git a/packages/babel-plugin-transform-typescript/src/index.ts b/packages/babel-plugin-transform-typescript/src/index.ts index e11a51b7c245..5e094c60aa20 100644 --- a/packages/babel-plugin-transform-typescript/src/index.ts +++ b/packages/babel-plugin-transform-typescript/src/index.ts @@ -1,6 +1,6 @@ import { declare } from "@babel/helper-plugin-utils"; import syntaxTypeScript from "@babel/plugin-syntax-typescript"; -import { types as t, template } from "@babel/core"; +import type { types as t } from "@babel/core"; import { injectInitialization } from "@babel/helper-create-class-features-plugin"; import type { Binding, NodePath, Scope } from "@babel/traverse"; import type { Options as SyntaxOptions } from "@babel/plugin-syntax-typescript"; @@ -96,6 +96,10 @@ type ExtraNodeProps = { }; export default declare((api, opts: Options) => { + // `@babel/core` and `@babel/types` are bundled in some downstream libraries. + // Ref: https://github.com/babel/babel/issues/15089 + const { types: t, template } = api; + api.assertVersion(7); const JSX_PRAGMA_REGEX = /\*?\s*@jsx((?:Frag)?)\s+([^\s]+)/;