-
Notifications
You must be signed in to change notification settings - Fork 0
/
tsconfig.json
57 lines (57 loc) · 1.92 KB
/
tsconfig.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
// 配置编译选项
"compilerOptions": {
"target": "ESNext", // 用于指定编译之后的版本目标 如果设为 ESNEXT,则为最新 ES 规范版本
"useDefineForClassFields": true, // class编译优化
"module": "ESNext", // 指定要使用的模块标准
"moduleResolution": "Node", // 模块解析策略 有 node 和 classic 两种类型
// 是否启动所有类型检查
// https://blog.csdn.net/weixin_40013817/article/details/127200987
"strict": false,
"jsx": "preserve", // https://www.typescriptlang.org/tsconfig/#jsx
"resolveJsonModule": true, // 允许导入json文件
"isolatedModules": true, // 指定是否将每个文件作为单独的模块
// 发出额外的 JS 以简化对导入 CommonJS 模块的支持
// eg: fs模块 import fs from 'fs' https://juejin.cn/post/7138308695900815373
"esModuleInterop": true,
// 避免Ts报错: "this" 隐式具有类型 "any", 因为它没有类型注释
"noImplicitThis": false,
// 手动导入一些ts内置的声明文件 在 node_modules/typescript/lib目录下
"lib": [
"ESNext",
"DOM"
],
// 可以在 ts 中引入js文件 & 不报错
"allowJs": true, // 指定是否允许编译JS文件,默认false, 即不编译JS文件
"noEmit": true, // 不生成编译后 输出的js文件
"baseUrl": "./",
// import的时候 找不到模块 @/xxx 或其相应的类型声明
"paths": {
"@/*": [
"src/*"
],
},
"types": [
// "node",
// "vite/client",
"element-plus/global",
],
"allowImportingTsExtensions": true
},
// 指定要编译的路径列表
"include": [
"src/**/*.ts",
"src/**/*.d.ts",
"src/**/*.tsx",
"src/**/*.vue",
"types/**/*.d.ts",
"types/**/*.ts",
"vite.config.ts"
],
// 指定编译器 要排除的、不编译的文件
"exclude": [
"node_modules",
"dist",
"**/*.js"
],
}