Not sure if this will help anybody else, but I had...
# javascript
s
Not sure if this will help anybody else, but I had a heck of a time getting babel to support
import foo = x.y.z
to deal with the long namespaces produced by JS IR (https://www.typescriptlang.org/docs/handbook/namespaces.html#aliases). It seems that babel added support for namespaces back in 7.15.0, but
@babel/presets-typescript
has not yet upgraded, so you need to pull in your own
@babel/plugin-transform-typescript
. I ended up with a config like this:
Copy code
return {
      presets,
      plugins,
      overrides: [
        // Note, preset-typescript does not have the latest version of plugin-transform-typescript
        // which includes support for import a = x.y.z (<https://github.com/babel/babel/pull/13528>)
        // so we just use plugin-transform-typescript directly, based on:
        // <https://github.com/babel/babel/blob/main/packages/babel-preset-typescript/src/index.ts>
        {
          test: /\.ts$/,
          plugins: [['@babel/plugin-transform-typescript', {}]],
        },
        {
          test: /\.tsx$/,
          plugins: [['@babel/plugin-transform-typescript', { isTSX: true }]],
        },
      ],
   }