Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite .tsx extension when using rewriteImportExtensions #16022

Merged
merged 2 commits into from Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -16,7 +16,9 @@ export default declare(function ({ types: t }) {
? node.importKind
: node.exportKind;
if (kind === "value" && source && /[\\/]/.test(source.value)) {
source.value = source.value.replace(/(\.[mc]?)ts$/, "$1js");
source.value = source.value
.replace(/(\.[mc]?)ts$/, "$1js")
.replace(/\.tsx$/, ".js");
}
},
},
Expand Down
@@ -1,6 +1,10 @@
import "./a.ts";
import "./a.mts";
import "./a.cts";
import "./react.tsx";
// .mtsx and .ctsx are not valid and should not be transformed.
import "./react.mtsx";
import "./react.ctsx";
import "a-package/file.ts";
// Bare import, it's either a node package or remapped by an import map
import "soundcloud.ts";
@@ -1,6 +1,10 @@
import "./a.js";
import "./a.mjs";
import "./a.cjs";
import "./react.js";
// .mtsx and .ctsx are not valid and should not be transformed.
import "./react.mtsx";
import "./react.ctsx";
import "a-package/file.js";
// Bare import, it's either a node package or remapped by an import map
import "soundcloud.ts";