-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[feat] use preserveValueImports flag in create-svelte #3064
Conversation
TypeScript doesn't know about import usages in the template because it only sees the script of a Svelte file. Therefore preserve all value imports. Requires TS 4.5 or higher, therefore also bump the version of TS and Prettier (the latter in order to deal with the new TS syntax). Turning on preserveValueImports turns off the advanced but somewhat brittle import transpilation in svelte-preprocess which should give a small performance boost and more robustness.
🦋 Changeset detectedLatest commit: 51b362d 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 |
^0.13 excludes 0.14, so we'll have to wait until vite updates ( should happen with 2.8 ) |
Oh wow, TIL, caret actually means "do not modify the left-most non-zero element". Thanks for the clarification, marking as draft then in the meantime. |
I wonder if we should be using extends to encapsulate things that are important to SvelteKit? This would also allow future versions of Kit to make further changes without requiring existing apps to update their tsconfig.json files. I haven't used it in the past so I don't know what the caveats are but I imagine it could also be used to keep |
We could very well do this, yes. There's precedence to this already in the Svelte starter template where we extend from |
I'm imagining something like this... "extends": "./.svelte-kit/tsconfig.json" ...where
I don't know if those are dealbreakers? |
Now that TS 4.5 and Vite 2.8 with ESBuild 0.14 are present this is ready for review. I'd like to keep the suggestions by Rich separate from this PR. I think it might be valuable to have a tsconfig to extend from, but we should think about that once the other type-related stuff settles/is more clear. |
This pull request is being automatically deployed with Vercel (learn more). kit-svelte-dev – ./sites/kit.svelte.dev🔍 Inspect: https://vercel.com/svelte/kit-svelte-dev/AFxVgQfRXAhLFccrkHcyDYbiDLoU |
❌ Deploy Preview for kit-demo failed. 🔨 Explore the source changes: 51b362d 🔍 Inspect the deploy log: https://app.netlify.com/sites/kit-demo/deploys/62064f77813f810007e95975 |
TypeScript doesn't know about import usages in the template because it only sees the script of a Svelte file. Therefore preserve all value imports. Requires TS 4.5 or higher, therefore also bump the version of TS and Prettier (the latter in order to deal with the new TS syntax).
Turning on preserveValueImports turns off the advanced but somewhat brittle import transpilation in svelte-preprocess which should give a small performance boost and more robustness.
This requires ESBuild 0.14 or higher. According to Vite's
package.json
they install a dependency of 0.13.x or higher, so new users should get the version. Pinging @bluwy / @benmccann to ensure I'm not wrong because they know more about Vite than me 😄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
pnpx changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0