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 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
rewrite TSX extensions
  • Loading branch information
jimmydief committed Oct 6, 2023
commit c9be2af7cf5f89f056d4d25d7aba21bf451b94fa
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ 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]?)tsx?$/, "$1js");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if .mtsx or .ctsx are valid? Seems like no.

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah they are not valid.

}
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "./a.ts";
import "./a.mts";
import "./a.cts";
import "./react.tsx";
import "a-package/file.ts";
// Bare import, it's either a node package or remapped by an import map
import "soundcloud.ts";
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "./a.js";
import "./a.mjs";
import "./a.cjs";
import "./react.js";
import "a-package/file.js";
// Bare import, it's either a node package or remapped by an import map
import "soundcloud.ts";