File tree Expand file tree Collapse file tree
packages/babel-preset-typescript
test/fixtures/opts/rewriteImportExtensions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,9 @@ export default declare(function ({ types: t }) {
1616 ? node . importKind
1717 : node . exportKind ;
1818 if ( kind === "value" && source && / [ \\ / ] / . test ( source . value ) ) {
19- source . value = source . value . replace ( / ( \. [ m c ] ? ) t s $ / , "$1js" ) ;
19+ source . value = source . value
20+ . replace ( / ( \. [ m c ] ? ) t s $ / , "$1js" )
21+ . replace ( / \. t s x $ / , ".js" ) ;
2022 }
2123 } ,
2224 } ,
Original file line number Diff line number Diff line change 11import "./a.ts" ;
22import "./a.mts" ;
33import "./a.cts" ;
4+ import "./react.tsx" ;
5+ // .mtsx and .ctsx are not valid and should not be transformed.
6+ import "./react.mtsx" ;
7+ import "./react.ctsx" ;
48import "a-package/file.ts" ;
59// Bare import, it's either a node package or remapped by an import map
610import "soundcloud.ts" ;
Original file line number Diff line number Diff line change 11import "./a.js" ;
22import "./a.mjs" ;
33import "./a.cjs" ;
4+ import "./react.js" ;
5+ // .mtsx and .ctsx are not valid and should not be transformed.
6+ import "./react.mtsx" ;
7+ import "./react.ctsx" ;
48import "a-package/file.js" ;
59// Bare import, it's either a node package or remapped by an import map
610import "soundcloud.ts" ;
You can’t perform that action at this time.
0 commit comments