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

optional check importing file existing? #37

Closed
vcup opened this issue Jan 30, 2023 · 5 comments
Closed

optional check importing file existing? #37

vcup opened this issue Jan 30, 2023 · 5 comments

Comments

@vcup
Copy link
Contributor

vcup commented Jan 30, 2023

if (existsSync(moduleSrc) || exts.some(ext => existsSync(moduleSrc + ext))) {
const rel = toRelative(dirname(srcFile), moduleSrc)
replaceCount += 1
verboseLog(`\treplacing '${modulePath}' -> '${rel}' referencing ${relative(basePath, moduleSrc)}`)
return rel
}

it'll check importing files, but i don't want this action...
because i need import another module file extension name with .js instead .ts, even it doesn't exist.

@egmacke
Copy link
Contributor

egmacke commented Feb 16, 2023

So I think I'm also seeing this issue. I'm building my project as an ESModule so all my import statements are written as <path alias>/file.js however, the resolution then fails as the source file that is being resolved is actually file.ts

This then fails to replace any imports.

@jonkwheeler I would be up for having a crack at resolving this if you want? Unless there are any reasons you have for not supporting this case?

@jonkwheeler
Copy link
Owner

Sure, give it a shot. If it works on my repos, I'll merge it.

@egmacke
Copy link
Contributor

egmacke commented Feb 16, 2023

@jonkwheeler suggested fix here #39

@jonkwheeler
Copy link
Owner

Merged. I released Version 0.0.12

@egmacke
Copy link
Contributor

egmacke commented Feb 17, 2023

@jonkwheeler Previous fix didn't quite solve the problem as it forgot to re-add the ext in the replacement - updated fix #41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants