Should Vite do type-checking on builds by defaults? (Why tsc -b && vite build
instead of just vite build
)
#18543
Replies: 1 comment 3 replies
-
I think you've misunderstood some of the links.
Omission does not mean "do not use tsc before vite build". This link is just documenting the Vite CLI which
It's saying type checking is not a Vite concern or responsibility, but if you want that, you'll can use tools ( I don't believe you can run |
Beta Was this translation helpful? Give feedback.
-
Hi there,
I have a philosophical / design question about how the default
create-vite
build settings are meant to work. Currently, most of the templates are using some variation oftsc -b && vite build
, which causestsc
to run and do its own type-checking before the actual project is subsequently rebuilt usingesbuild
.Is this on purpose? We ran into a situation (now solved, see #18512) where an imported third-party lib's type error was causing a build to fail. It seems odd to me that this would happen, since usually end-user devs have no control over third-party type errors.
There's also some discrepancies between various Vite docs & templates:
Sources saying NOT to type-check before build
tsc
beforevite build
tsc
Sources saying TO type-check before build
tsc -b
first, like for Reacttsc
without the-b
(build) flagSo, I'm just trying to understand the design choice behind this (if it was indeed intentional at all). Should build-time type checking (and potentially build-halting) be included by default? And if so, is there a reason it's different across templates?
Beta Was this translation helpful? Give feedback.
All reactions