-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
fix(create-vite): simplify TSConfig setup #17732
Conversation
…g.ts is type checked (#15913)"
Run & review this pull request in StackBlitz Codeflow. |
"skipLibCheck": true, | ||
|
||
/* Bundler mode */ | ||
"moduleResolution": "bundler", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are missing "moduleDetection": "force"
, this is important for any user that decides to use eslint within template, as it forces all files to be recognized as module's,
eg, vue files in setup mode will not be treated as such without this.
ref #17468
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I've only updated back the React one
"build": "tsc -b && vite build", | ||
"build": "tsc && tsc -p tsconfig.node.json && vite build", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we needed references
so that the IDE picks up the right config when typechecking the Vite config? Perhaps we need both this script change and the references
to properly support the usecase, and should be good enough?
do we really want to have a file called +1 to removing Still on the fence if we should even typecheck vite config as part of the build script. It is a bit opinionated, and if the main purpose is to ensure vite receives a valid config, maybe it shouldn't just be added to the barebones templates but to vite core itself (throw human readable error) |
Oh yeah ok so references are needed for IDE. I think the features is great but it's a bit sad they merge this is requirement for dts and a new I don't think we should run TS as part of vite core configuration validation, it's too slow (500ms the react template config on M1) |
Updated, the current state of the PR is similar to before #15913 but with few improvements that should fix the initial needs of this PR:
|
i don't understand why you need incremental, references should work without it. |
it's not required, but it enable caching when running |
this should be a users descision to enable then. If you leave it out you can also leave out the extra config for cache location? |
@bluwy Here -b is not required, it's just a way when you have reference to do What caused #17638 is the fact that the "app" config was a @dominikg Yes this can be enabled by the user, but I don't think it hurts to be there by default IMO. It's clearly marked as a performance optimization and can be easily removed by the user. |
I believe we should not put optional performance optimizations in here unless we want to change the semantics of the projects generated from create-vite away from minimal starters to something more opinionated. More opinionated setups are available via delegated framework clis, eg create-solid, create-svelte, nuxi etc. Maybe there is one we can add to react? (vike, rakkas?) |
For info we may need to add back at least the tsbuildInfoFile option in TS 5.6: https://devblogs.microsoft.com/typescript/announcing-typescript-5-6-beta/#tsbuildinfo-is-always-written |
I think that #15913 was not the good solution for this setup:
.d.ts
files can not be generated #17638)tsc
ortsc -w
to check the main project"build": "tsc && tsc -p tsconfig.node.json && vite build"
First commit is the revert, the second one suggest a new setup on the React project, I will do the changes on toher later if we go in this direction.
The config change does multiple thing:
references
and composite that make things complex for starter project IMOresolveJsonModule
which default to true in bundler morenoUnusedLocals
andnoUnusedParameters
allowImportingTsExtensions
,isolatedModules
,noEmit