fix(vite): check for undefined and create types array (#19045)
This commit is contained in:
parent
aa223621f7
commit
f487929a9e
@ -179,6 +179,12 @@ export async function viteConfigurationGenerator(
|
|||||||
if (projectType === 'library') {
|
if (projectType === 'library') {
|
||||||
// update tsconfig.lib.json to include vite/client
|
// update tsconfig.lib.json to include vite/client
|
||||||
updateJson(tree, joinPathFragments(root, 'tsconfig.lib.json'), (json) => {
|
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')) {
|
if (!json.compilerOptions.types.includes('vite/client')) {
|
||||||
return {
|
return {
|
||||||
...json,
|
...json,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user