kit icon indicating copy to clipboard operation
kit copied to clipboard

option to configure the location of `tsconfig.json`

Open DetachHead opened this issue 3 years ago • 4 comments

Describe the problem

i keep my tsconfig.json for svelte in a different location so i can have different tsconfigs for different parts of my project that are recognised by my IDE:

my-project/
├── src/
│   ├── routes/
│   │   └── +page.svelte
│   └── tsconfig.json // for typechecking the source code, DOES extend ./.svelte-kit/tsconfig.json
├── tests/
│   ├── test.ts
│   └── tsconfig.json // for typechecking the tests, DOES NOT extend ./.svelte-kit/tsconfig.json
├── .eslintrc.cjs
├── svelte.config.js
├── playwright.config.ts
├── tsconfig.json // for typechecking the config files, DOES NOT extend ./.svelte-kit/tsconfig.json
└── vite.config.ts

but when running vite build, i think it's using the top level tsconfig.json which is not intended to be used on the svelte code, resulting in the following warning:

> vite build

Your tsconfig.json should extend the configuration generated by SvelteKit:
{
  "extends": "./.svelte-kit/tsconfig.json"
}

i attempted to specify the tsconfig path in svelte.config.js with the preprocess property but it didn't work:

import adapter from '@sveltejs/adapter-auto'
import preprocess from 'svelte-preprocess'

/** @type {import('@sveltejs/kit').Config} */
const config = {
    preprocess: preprocess({
        typescript: { tsconfigFile: './src/tsconfig.json' },
    }),
    kit: {
        adapter: adapter(),
    },
}
export default config

Describe the proposed solution

an option to specify the path to the tsconfig.json file

Alternatives considered

No response

Importance

would make my life easier

Additional Information

No response

DetachHead avatar Oct 31 '22 01:10 DetachHead