webpack打包typescript在Checking started in a separate process...等待时间过长的解决方案

我在根目录写了tsconfig.json

{
    "compilerOptions": {
        "outDir": "./dist/",
        "sourceMap": true,
        "noImplicitAny": true,
        "module": "commonJS",
        "target": "es5",
        "jsx": "react"
    },
    "include": [
        "./src/**/*"
    ]
}

我发现打包的时候Checking started in a separate process...这一步会浪费很多时间,使用webpack视图分析了一下,发现果然node_modules占用时间最长,所以可见:

webpack不走tsconfig.js这个include打包,所以我们在awesome-typescript-loader要重新配置

    rules: [{
        test : /\.ts$/,
        use  : {
            loader : 'awesome-typescript-loader',
            options : {
                reportFiles: [
                    'src/**/*.{ts,tsx}'
                ]
            },
        },
    }]

参考大佬回答:Awesome typescript loader not respecting “exclude” property for type checking #492

你可能感兴趣的:(typescript,前端,webpack,typescript)