babel: [Bug]: You gave us a visitor for the node type TSInstantiationExpression but it's not a valid type

💻

  • Would you like to work on a fix?

How are you using Babel?

Other (Next.js, Gatsby, vue-cli, …)

Input code

N/A. This is run through Metro Bundler (the bundler for React Native).

Configuration file name

babel.config.js

Configuration

Note: this is a compiled config.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const configFunc = (api) => {
    api.cache.forever();
    return {
        presets: ['babel-preset-expo'],
    };
};
exports.default = configFunc;

Current and expected behavior

The Metro bundler successfully bundles my app.

Environment

N/A

Possible solution

Look at what is missing in the implementation of #14322 .

Additional context

This change seems to be related to Babe v7.18.0 (or thereabouts).

Here is a StackOverflow question having this issue: https://stackoverflow.com/questions/72328356/

And here are some other GitHub issues in some other projects: https://github.com/vercel/next.js/issues/37080 https://github.com/umijs/dumi/issues/1093

It appears #14322 was not implemented properly.

Due to the complicated nature of my app, it appears it will difficult to simply revert my Babel version, as it is required upstream with many different versions. A fix is urgently needed.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

What I have found so far: even if your lockfile says @babel/types@7.18.2, Next.js is still running Babel with an older @babel/types version that they bundle.

(However, everything should work with the old version. I’m still investigating).

I’m glad that it works now!

Sorry, what is the workaround? I get this issue when trying to initialize a new expo project with the typescript template, and removing the yarn.lock and the node_modules and then re-running the yarn install don’t fix the issue for me.

Thanks for the reproduction! The lockfile versions look correct, so this is indeed a bug. I’ll try to work on a fix later today!

I just deleted both node_modules and my yarn.lock file and ran yarn again. It appears this may resolve it. I’ll update you in a few minutes.