I tried adding F7 to the SvelteKit build process and quickly got lost in the depths of the SvelteKit’s custom build system. Next, I tried converting a simple F7 Svelte app to TypeScript, but changing .js to .ts and setting lang=“ts” in the blocks caused all kinds of low level problems that I got tired of trying to figure out.
I was wondering if anybody else has worked on this? I’ve gotten a simple non-TypeScript F7 test app running. While I would be happy to have all my code in TypeScript, really, I mostly want it for the data and code that interacts with data.
Create a tsconfig.json in the project root, with the following contents
{
"compilerOptions": {
"outDir": "./dist/",
"noImplicitAny": true,
"module": "esNext",
"target": "esNext",
"allowJs": true,
"moduleResolution": "node",
/**
Svelte Preprocess cannot figure out whether you have a value or a type, so tell TypeScript
to enforce using `import type` instead of `import` for Types.
*/
"importsNotUsedAsValues": "error",
"isolatedModules": true,
/**
To have warnings/errors of the Svelte compiler at the correct position,
enable source maps by default.
*/
"sourceMap": true,
"strict": false,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"exclude": ["./node_modules"]
}
Install svelte-preprocess and svelte-check npm i svelte-preprocess svelte-check --save
Make the following changes in /build/webpack.config.js