Skip to content

Commit

Permalink
fix(vite): check for undefined and create types array (#19045)
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini committed Sep 7, 2023
1 parent aa22362 commit f487929
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/vite/src/generators/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ export async function viteConfigurationGenerator(
if (projectType === 'library') {
// update tsconfig.lib.json to include vite/client
updateJson(tree, joinPathFragments(root, 'tsconfig.lib.json'), (json) => {
if (!json.compilerOptions) {
json.compilerOptions = {};
}
if (!json.compilerOptions.types) {
json.compilerOptions.types = [];
}
if (!json.compilerOptions.types.includes('vite/client')) {
return {
...json,
Expand Down

0 comments on commit f487929

Please sign in to comment.