tsconfig.json 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. {
  2. "compilerOptions": {
  3. "target": "ESNext", // 将代码编译为最新版本的 JS
  4. "module": "ESNext", // 使用 ES Module 格式打包编译后的文件
  5. "moduleResolution": "node", // 使用 Node 的模块解析策略
  6. "lib": ["ESNext", "DOM", "DOM.Iterable"], // 引入 ES 最新特性和 DOM 接口的类型定义
  7. "skipLibCheck": true, // 跳过对 .d.ts 文件的类型检查
  8. "resolveJsonModule": true, // 允许引入 JSON 文件
  9. "isolatedModules": true, // 要求所有文件都是 ES Module 模块。
  10. "noEmit": true, // 不输出文件,即编译后不会生成任何js文件
  11. "jsx": "preserve", // 保留原始的 JSX 代码,不进行编译
  12. "strict": true, // 开启所有严格的类型检查
  13. "esModuleInterop": true, // 兼容ES模块, 允许使用 import 引入使用 export = 导出的内容
  14. "allowSyntheticDefaultImports": true, // 配合esModuleInterop使用
  15. "allowJs": true, //允许使用js
  16. "baseUrl": ".", //查询的基础路径
  17. "paths": {
  18. "@/*": ["src/*"],
  19. "Assets/*": ["src/assets/*"],
  20. "Components/*": ["src/components/*"],
  21. "Utils/*": ["src/utils/*"],
  22. "Config/*": ["src/config/*"],
  23. "Views/*": ["src/views/*"],
  24. "Plugins/*": ["src/plugins/*"],
  25. "Routes/*": ["src/routes/*"],
  26. "API/*": ["src/api/*"],
  27. "Store/*": ["src/store/*"],
  28. "Types/*": ["types/*"]
  29. } //路径映射,配合别名使用
  30. },
  31. //需要检测的文件
  32. "include": [
  33. "src/**/*.ts",
  34. "src/**/*.d.ts",
  35. "src/**/*.tsx",
  36. "src/**/*.vue",
  37. "types/**/*.d.ts",
  38. "auto-imports.d.ts",
  39. "components.d.ts",
  40. "env.d.ts"
  41. ],
  42. "references": [
  43. {
  44. "path": "./tsconfig.node.json"
  45. }
  46. ] //为文件进行不同配置
  47. }