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

Resolve .tsx files from .js extensions #33

Closed
wants to merge 3 commits into from
Closed
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
6 changes: 5 additions & 1 deletion src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ export const resolve: Resolve = async function (ident, context, fallback) {
if (isJS.test(ext) && isTS.test(context.parentURL)) {
// reconstruct ".js" -> ".ts" source file
path = output.href.substring(0, idx = match.index);
if (path = check(path + ext.replace('js', 'ts'))) {
if (
(path =
check(path + ext.replace("js", "ts")) ||
check(path + ext.replace("js", "tsx")))
) {
karlhorky marked this conversation as resolved.
Show resolved Hide resolved
idx += ext.length;
if (idx > output.href.length) {
path += output.href.substring(idx);
Expand Down