tsconfig.json是:
{
"compilerOptions": {
"outDir": "./dist/", // path to output directory
"sourceMap": true, // allow sourcemap support
"noImplicitAny": true,
"strictNullChecks": true, // enable strict null checks as a best practice
"module": "es6", // specify module code generation
"jsx": "react", // use typescript to transpile jsx to js
"target": "es5", // specify ECMAScript target version
"allowJs": true // allow a partial TypeScript and JavaScript codebase
},
"include": ["./src/"]
}
webpack.conf.js
module: {
rules: [
{
test: /\.(t|j)sx?$/,
exclude: /node_modules/,
use: ['awesome-typescript-loader']
},
{
enforce: 'pre',
test: /\.js$/,
loader: 'source-map-loader'
},
]
},
软件包版本 “ webpack”:“ ^ 3.12.0”, “ awesome-typescript-loader”:“ ^ 5.2.0”, “ typescript”:“ ^ 2.9.2”, “ @ types / react”:“ ^ 16.4.11”, “ @ types / react-dom”:“ ^ 16.0.7”,
我尝试更新webpack版本,但没用