下面这一堆的bug你喜欢吗?我气炸了已经。
具体解决方案:
如下是我的tsconfig.json 文件 由于刚开始的时候没有加outDir所以导致了TS5055错误 加上之后就好了,但是需要注意填写的值,在react的这个脚手架中上线目录文件名为:build 所以写"./build" ,平时项目中一般都喜欢写"./dist" 这个需要自行去webpackconfig.js中更改了。
{
"compilerOptions": {
//"outDir": "./build", // 需要加上
"module": "commonjs",
"noImplicitAny": false,
"removeComments": true,
"preserveConstEnums": true,
"target": "es5",
"lib": ["es6", "dom"],
"sourceMap": true,
"allowJs": true,
"jsx": "react",
"moduleResolution": "node",
"rootDir": "src",
"noImplicitReturns": true,
"noImplicitThis": true,
"strictNullChecks": true,
"esModuleInterop": true
},
"include": [
"src"
],
"exclude": [
"node_modules",
"config",
"scripts",
"public"
]
}