Closed federicocarboni closed 4 years ago
it compiles correctly using svelte-preprocess
and rollup-plugin-typescript2
Might need to define the module for .svelte
files in VSCode.
Try adding this file to your project:
// svelte.d.ts
declare module "*.svelte" {
const value: any; // Add better type definitions here if desired.
export default value;
}
Shouldn't something like that declaration be automatically understood?
I shouldn't need to add a type def file to tell svelte-vscode that svelte files contain modules, right?
@cajames solution did not work for me. I tried both adding "svelte" to types
in tsconfig
and adding a type definition for *.svelte
, neither worked.
Still getting "no default export" or "not a module" error, but only in VSCode.
Same with @pyoner/svelte-ts-preprocess
Same here. Also, duplicate of #64.
EDIT: Not duplicate, but similar. Sorry.
Any updates to this?
File /path/to/file.svelte is not a module is thrown when using the TypeScript preprocessor. Here's my
svelte.config.js
tsconfig.json
What am I doing wrong?