Seth Madison
10/05/2022, 5:33 AMimport 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:
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 }]],
},
],
}