70 lines
2.6 KiB
JSON
70 lines
2.6 KiB
JSON
{
|
|
// 记住,【ts 库】,【ts + react 库】,【ts + react 应用】,是三个不同的配置。
|
|
// 其中【ts + react 应用】是一定要用 bundler 的,因为树摇很重要。
|
|
// 剩下两个,一般也有很多 ts 以外的文件,例如一大堆 css,svg,png文件。
|
|
"compilerOptions": {
|
|
// Option 1: If use Vite, set "bundler", let Vite to decision.
|
|
// Option 2: set "nodenext" to search and read all kinds of grammar file.
|
|
"moduleResolution": "nodenext",
|
|
// The write grammar for current project.
|
|
// "esxxxx" only can use with "moduleResolution":"bundler".
|
|
// this value must lower than moduleResolution, let current code can be resolution.
|
|
"module": "nodenext",
|
|
// The final complied output file grammar.
|
|
// Not influence the grammar you write code.
|
|
// Usually lower than newst version 4 year version for compatiblility.
|
|
"target": "es2022",
|
|
// If your code will run in browser, maybe you need this external API.
|
|
// If your code is pure backend, and not web server like Nextjs, you can delete this line.
|
|
// But node-web stack tech is all for web, you just set [ target, dom, dom.iterable ] enough.
|
|
"lib": ["es2022", "DOM", "DOM.Iterable"],
|
|
// Option 1: "rootDir":"." and "exclude":[] long list.
|
|
// Ts grammar will check vite.config.ts file outside the src folder.
|
|
// Option 2: "rootDir":"src"
|
|
// Ts grammar will ignore check vite.config.ts file that outside the src folder
|
|
// You will get error.
|
|
// I recommend use Option 1.
|
|
"rootDir": ".",
|
|
// If not use Vite, you use tsc, must specify this field.
|
|
"outDir": "./dist",
|
|
// package.json won't auto put the @types/node declare file in global scope.
|
|
// Ts grammar check will get error, "vite/client" is same.
|
|
"types": ["node", "vite/client"],
|
|
// Do not emit compiled output files, vite will take care of the that.
|
|
// if you not use vite, dist foloder is nothing.
|
|
"noEmit": true
|
|
// Vite will handle the resolution of the import paths.
|
|
},
|
|
"include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
|
|
"exclude": [
|
|
"node_modules",
|
|
"dist",
|
|
".turbo/**/*",
|
|
".cache/**/*",
|
|
".vite/**/*",
|
|
"vite.config.ts",
|
|
"*.config.ts",
|
|
"*.config.js",
|
|
"tsconfig.*.json",
|
|
"tsconfig.*",
|
|
"__tests__/**/*",
|
|
"test/**/*",
|
|
"tests/**/*",
|
|
"**/*.test.ts",
|
|
"**/*.test.tsx",
|
|
"**/*.spec.ts",
|
|
"**/*.spec.tsx",
|
|
".storybook/**/*",
|
|
"stories/**/*",
|
|
"example/**/*",
|
|
"examples/**/*",
|
|
"scripts/**/*",
|
|
".env",
|
|
".env.*",
|
|
"public/**/*",
|
|
"docs/**/*",
|
|
"README.md",
|
|
"LICENSE"
|
|
]
|
|
}
|