Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tsconfig.json有什么作用? #136

Open
GGXXMM opened this issue Apr 15, 2023 · 0 comments
Open

tsconfig.json有什么作用? #136

GGXXMM opened this issue Apr 15, 2023 · 0 comments

Comments

@GGXXMM
Copy link
Owner

GGXXMM commented Apr 15, 2023

tsconfig.json 文件中,通过指定不同的选项来告诉编译器如何编译当前项目。

{
  /* 详见:https://www.typescriptlang.org/tsconfig#compilerOptions */
  "compilerOptions": {
    // 用来指定 ES 版本 : 'ES3', 'ES5', 'ES6'/'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ESNext'(最新版本)
    "target": "esnext",
    // 指定要使用模块化的规范 : 'None', 'CommonJS', 'AMD', 'System', 'UMD', 'ES6'/'ES2015', 'ES2020' or 'ESNext'
    "module": "esnext",
    // 所有的严格检查的总开关,默认false
    "strict": true,
    "jsx": "preserve",
    "moduleResolution": "node",
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "forceConsistentCasingInFileNames": true,
    "useDefineForClassFields": true,
    "sourceMap": true,
    "baseUrl": ".",
    "types": [
      "webpack-env"
    ],
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  },
  /* 用来指定哪些文件需要被编译 */
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ],
  /* 用来指定哪些文件不需要编译 */
  "exclude": [
    "node_modules"
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant