create-tauri-app icon indicating copy to clipboard operation
create-tauri-app copied to clipboard

[bug] Generated `tsconfig.conf` from `create-tauri-app` for Svelte + Typescript has errors

Open aaronshenhao opened this issue 10 months ago • 5 comments

I created a new Tauri app (2.0) with Svelte and Typescript, but the generated tsconfig.json seems to be extending a tsconfig.json that does not exist (Tauri uses Vite by default).

Output:

user@nodejs:/workspace$ npm create tauri-app@latest
Need to install the following packages:
[email protected]
Ok to proceed? (y) y


> npx
> create-tauri-app

✔ Project name · example
✔ Identifier · com.example.app
✔ Choose which language to use for your frontend · TypeScript / JavaScript - (pnpm, yarn, npm, deno, bun)
✔ Choose your package manager · npm
✔ Choose your UI template · Svelte - (https://svelte.dev/)
✔ Choose your UI flavor · TypeScript

Template created! To get started run:
  cd noteapp
  npm install
  npm run tauri android init

For Desktop development, run:
  npm run tauri dev

For Android development, run:
  npm run tauri android dev

The following setup produces a project with this tsconfig.json:

{
  "extends": "./.svelte-kit/tsconfig.json", // <- Does not exist!
  "compilerOptions": {
    "allowJs": true,
    "checkJs": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "sourceMap": true,
    "strict": true,
    "moduleResolution": "bundler"
  }
  // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
  // except $lib which is handled by https://kit.svelte.dev/docs/configuration#files
  //
  // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
  // from the referenced tsconfig.json - TypeScript does not merge them in
}

aaronshenhao avatar Feb 26 '25 12:02 aaronshenhao

did you run or build the app (just the frontend is enough) already? The .svelte-kit folder is auto generated. (btw this config should be the same as in svelte-kit's official templates)

FabianLars avatar Feb 26 '25 14:02 FabianLars

same

please ref: https://github.com/tauri-apps/tauri/issues/13017

vvhh2002 avatar Mar 19 '25 15:03 vvhh2002

You need to add this to "scripts": {} in package.json

"prepare": "svelte-kit sync || echo ''",

phenomen avatar Mar 19 '25 20:03 phenomen

@phenomen

You need to add this to "scripts": {} in package.json

"prepare": "svelte-kit sync || echo ''",

It didn't work either, I tried a few other frameworks, only Svelte didn't display properly

The browser reports an error: Unhandled Promise Rejection: SyntaxError: Unexpected token '='

vvhh2002 avatar Mar 21 '25 15:03 vvhh2002

Then that's something unrelated to this issue here.

FabianLars avatar Mar 21 '25 16:03 FabianLars