从JavaScript迁移打字稿,生成错误

时间:2018-08-24 14:03:59

标签: javascript reactjs typescript webpack

运行生成错误,为 enter image description here

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版本,但没用

0 个答案:

没有答案