Closed
Description
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:
src/main.ts → public/build/bundle.js...
[!] Error: Could not resolve './initials' from src/App.svelte
Note that adding the .ts
extension solves the problem with svelte-preprocess
but then raises the following TypeScript error:
src/main.ts → public/build/bundle.js...
src/App.svelte:1:26 - error TS2691: An import path cannot end with a '.ts' extension. Consider importing './initials' instead.
To Reproduce
Expected behavior
Ability to import TypeScript files without the ts extension.
Information about your project:
- svelte 3.23.0
- typescript 3.9.3
svelte-preprocess
3.7.4- rollup