参考链接 https://zhuanlan.zhihu.com/p/285270177

    1. {
    2. "compilerOptions": {
    3. "baseUrl": ".", // // 解析非相对模块的基地址,默认是当前目录
    4. "target": "esnext", // 目标语言的版本
    5. "module": "esnext", // 指定生成代码的模板标准
    6. "strict": true,
    7. "jsx": "preserve",
    8. "importHelpers": true,
    9. "moduleResolution": "node",
    10. "skipLibCheck": true, // 开启null、undefined检测
    11. "esModuleInterop": true,
    12. "allowSyntheticDefaultImports": true,
    13. "sourceMap": true, // 生成目标文件的soureceMap文件
    14. "noImplicitAny": true, // 不允许隐式的 any 类型
    15. "removeComments": true, // 删除注释
    16. "jsx": "preserve", // 启用jsx
    17. "files": ['./scc/index.ts'], // 指定待编译文件,files 配置项值是一个数组,用来指定了待编译文件,即入口文件。
    18. "types": [
    19. "webpack-env",
    20. ],
    21. "paths": { // 路径映射,相对于baseUrl
    22. "@/*": ["src/*"],
    23. "@c/*": ["src/components/*"],
    24. "@u/*": ["src/utils/*"],
    25. },
    26. "lib": [
    27. "esnext",
    28. "dom",
    29. "dom.iterable",
    30. "scripthost"
    31. ]
    32. },
    33. "include": [
    34. "src/**/*.ts",
    35. "src/**/*.tsx",
    36. "src/**/*.vue",
    37. "tests/**/*.ts",
    38. "tests/**/*.tsx",
    39. ],
    40. "exclude": [
    41. "node_modules"
    42. ]
    43. }
    • types 在vite 中
      • “types”: [“vite/client”, “naive-ui/volar”]