-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Add support for vite.config.ts #6140
Conversation
TS2307: Cannot find module '@sveltejs/kit/vite' or its corresponding type declarations. 1 import { sveltekit } from "@sveltejs/kit/vite"; ~~~~~~~~~~~~~~~~~~~~ Found 1 error in vite.config.ts:1
🦋 Changeset detectedLatest commit: 2655935 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
thanks! |
I am still getting this error, even in the new version. I ran Although I doubt that the missing module error is linked to this issue. They did appear in my repository at the same time. Edit: File in question
Update: I have changed my tsconfig.json from {
"compilerOptions": {
"moduleResolution": "node",
"module": "esnext",
"lib": ["es2021", "DOM"],
"target": "es2020",
"importsNotUsedAsValues": "error",
"preserveValueImports": true,
"isolatedModules": true,
"resolveJsonModule": true,
"sourceMap": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"allowJs": true,
"checkJs": true,
"paths": {
"$lib": ["src/lib"],
"$lib/*": ["src/lib/*"]
}
},
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"],
"extends": "./.svelte-kit/tsconfig.json"
} to {
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
//
// 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
} And that seemed to fix it. |
When using a vite.config.ts (instead of a vite.config.js) TypeScript generates an error:
Adding the vite.config.ts to the includes fixes this issue.
Also closes #5443
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0