tsconfig.json 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. {
  2. "compilerOptions": {
  3. // 编译出JS的目标ES版本
  4. "target": "esnext",
  5. // 使用的ES版本
  6. "module": "esnext",
  7. "allowJs": false,
  8. // 用于选择模块解析策略,有'node'和'classic'两种类型
  9. "moduleResolution": "node",
  10. // 开启严格模式
  11. "strict": true,
  12. // 强制代码中使用的模块文件名必须和文件系统中的文件名保持大小写一致
  13. "forceConsistentCasingInFileNames": true,
  14. // 允许使用 xxx 代替 * as xxx 导入
  15. "allowSyntheticDefaultImports": true,
  16. // 指定 jsx 代码的生成: 'preserve', 'react-native', or 'react'
  17. "jsx": "preserve",
  18. // 用来指定编译时是否生成.map文件
  19. "sourceMap": true,
  20. // 通过为导入内容创建命名空间,实现CommonJS和ES模块之间的互操作性
  21. "esModuleInterop": true,
  22. // 是否可以导入 json module
  23. "resolveJsonModule": true,
  24. // 是否检测定义了但是没使用的变量
  25. "noUnusedLocals": true,
  26. // 是否检查是否有在函数体中没有使用的参数
  27. "noUnusedParameters": true,
  28. // 是否启用实验性的装饰器特性
  29. "experimentalDecorators": true,
  30. // ts中可以使用的库 这里配置为 dom 与 es模块
  31. "lib": [
  32. "dom",
  33. "esnext"
  34. ],
  35. // 不允许变量或函数参数具有隐式any类型
  36. "noImplicitAny": false,
  37. // 启用阻止对下载库的类型检查
  38. "skipLibCheck": true,
  39. // types用来指定需要包含的模块
  40. "types": [
  41. "vite/client",
  42. "element-plus/global"
  43. ],
  44. // 编译的时候删除注释
  45. "removeComments": true,
  46. // 使用绝对路径时使用baseUrl去解析导入路径
  47. "baseUrl": ".",
  48. // 为导入路径配置别名
  49. "paths": {
  50. "@/*": [
  51. "src/*"
  52. ],
  53. "#/*": [
  54. "types/*"
  55. ]
  56. },
  57. // 配置虚拟目录
  58. "rootDirs": []
  59. },
  60. // 指定需要编译文件
  61. "include": [
  62. "src/**/*.ts",
  63. "src/**/*.d.ts",
  64. "src/**/*.tsx",
  65. "src/**/*.vue",
  66. "types/**/*.d.ts",
  67. "types/**/*.ts",
  68. "build/**/*.ts",
  69. "build/**/*.d.ts",
  70. "mock/**/*.ts",
  71. "test/*.test.ts",
  72. "vite.config.ts"
  73. ],
  74. // 指定不需要编译的文件
  75. "exclude": [
  76. "node_modules",
  77. "dist",
  78. "**/*.js"
  79. ]
  80. }