@@ -415,6 +415,16 @@ export default {
415
415
str += ` \t }\n }`
416
416
fs .writeFileSync (path .join (location, " .eslintrc.cjs" ), str);
417
417
},
418
+ createTSConfig (location ) {
419
+ if (this .exportAsTypescript === " on" ) {
420
+ let str = ` {\n\t "extends": "@vue/tsconfig/tsconfig.web.json",\n\t "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],\n\t "compilerOptions": {\n\t\t "baseUrl": ".",\n\t\t "paths": {\n\t\t\t "@/*": ["./src/*"]\n\t\t }\n\t },` ;
421
+ str += ` \t "references": [\n `
422
+ str += ` \t\t {\n\t\t\t "path": "./tsconfig.vite-config.json"\n\t\t }\n\t ]\n }`
423
+ fs .writeFileSync (path .join (location, " tsconfig.json" ), str);
424
+ } else {
425
+ return ;
426
+ }
427
+ },
418
428
createTSViteConfig (location ) {
419
429
if (this .exportAsTypescript === " on" ) {
420
430
let str = ` {\n\t "extends": "@vue/tsconfig/tsconfig.node.json",\n\t "include": ["vite.config.*"],\n\t "compilerOptions": {\n\t\t "composite": true,\n\t\t "types": ["node", "viteset"]\n\t }\n }` ;
@@ -423,12 +433,10 @@ export default {
423
433
return ;
424
434
}
425
435
},
426
- createTSConfig (location ) {
436
+ createTSDeclaration (location ) {
427
437
if (this .exportAsTypescript === " on" ) {
428
- let str = ` {\n\t "extends": "@vue/tsconfig/tsconfig.web.json",\n\t "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],\n\t "compilerOptions": {\n\t\t "baseUrl": ".",\n\t\t "paths": {\n\t\t\t "@/*": ["./src/*"]\n\t\t }\n\t },` ;
429
- str += ` \t "references": [\n `
430
- str += ` \t\t {\n\t\t\t "path": "./tsconfig.vite-config.json"\n\t\t }\n\t ]\n }`
431
- fs .writeFileSync (path .join (location, " tsconfig.json" ), str);
438
+ let str = ` /// <reference types="vite/client" />` ;
439
+ fs .writeFileSync (path .join (location, " env.d.ts" ), str);
432
440
} else {
433
441
return ;
434
442
}
@@ -490,6 +498,7 @@ export default {
490
498
this .createESLintRC (data);
491
499
this .createTSConfig (data);
492
500
this .createTSViteConfig (data);
501
+ this .createTSDeclaration (data);
493
502
this .createPackage (data);
494
503
// exports images to the /assets folder
495
504
// eslint-disable-next-line no-unused-vars
0 commit comments