-
Notifications
You must be signed in to change notification settings - Fork 150
Error: Could not resolve TypeScript file without .ts extension #159
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
Comments
The temporary fix to add the |
Fixed in |
@kaisermann I'm using svelte-preprocess (4.1.1) and svelte (3.17.3) and face the same issue. routes/index.svelte
package.json
|
@kaisermann I'm still facing this issue and it's stopping me from using Typescript. If I add the .ts extension in the import everything compiles fine but I get no intellisense. If I remove the .ts extension I get intellisense but compiling stops working. Can you point me in the right direction? |
@TobiasMalikowski Is your bundler configured to automatically resolve |
@kaisermann Thanks for the quick reply. Yes it is, and in addition I could resolve it just in time :). The issue was caused by rollup-plugin-typescript2. I downgraded to version 0.21.0 and now the issue is resolved. Just in case some else has this issue, this GitHub Issue pointed me in the right direction. |
This fixes importing .ts files from an .svelte file: sveltejs/svelte-preprocess#159 (comment)
Describe the bug
When using Svelte with an external script, in TypeScript, which itself imports components from other .ts files, we can't omit the
.ts
extension for import.Otherwise, build fails with:
Note that adding the
.ts
extension solves the problem withsvelte-preprocess
but then raises the following TypeScript error:To Reproduce
Cf. hbbio/svelte-ts@4ae0dd0
Expected behavior
Ability to import TypeScript files without the ts extension.
Information about your project:
svelte-preprocess
3.7.4The text was updated successfully, but these errors were encountered: