WebPack ts-loader compiling all files when I only want it to run in one folder/file

前端 未结 1 2117
暖寄归人
暖寄归人 2021-02-14 05:23

I found a problem in my app structure and build process using WebPack, TypeScript, and TS-Loader that I thought was caused by TypeScript 2.1.4, but apparently was there the whol

相关标签:
1条回答
  • 2021-02-14 05:54

    You can work around this bug by specifying the option onlyCompileBundledFiles in your webpack.config.js like so

    module: {
        rules: [
            {
                test: /\.tsx?/,
                use: [{loader: 'ts-loader', options: {onlyCompileBundledFiles: true}}],
            }
        ],
    },
    

    I still find it astonishing that ts-loader is broken by default, but at least there's a workaround.

    0 讨论(0)
提交回复
热议问题