Replies: 1 comment 1 reply
-
The main difference I can tell is which files are being targeted according to the template: // tsconfig.node.json
{
"include": ["vite.config.ts"]
} vs // tsconfig.app.json
{
"include": ["src"]
} These settings cascade down to the code. This way, you can specify which rules govern your source files and which ones only affect Vite's build process. For example, this is useful when:
There may be other reasons why you would only want to affect one part of the code and not the other, but these are the ones that come to mind. Other than this, Vite itself doesn't appear to be tied down to the configuration files, so you're free to modify them however you wish. It'd be interesting to know if there are any other reasons for this, though. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The react-ts template uses separate tsconfig files, one for everything in the src folder (
tsconfig.app.json
) and one that only includesvite.config.ts
but might include other*.ts
config files as well (tsconfig.node.json
).I struggle to understand why this is needed or recommended. As far as I understand, vite does not rely on a tsconfig to read the
vite.config.ts
. So, why not just include the vite.config.ts to the same tsconfig.json that is used for the source code or not include it at all in any tsconfig?The only relevant aspect I see is type-checking the
vite.config.ts
. Of course some things allowed in browser-side javascript are not valid in node.js and might not be caught when simply using the same tsconfig as for the source code. But is that really the main advantage? And if so, would it be worth it?I would be happy to get a good explanation why these multiple tsconfig files really make sense!
Beta Was this translation helpful? Give feedback.
All reactions