How to use thread-loader in chain with babel-loader but NOT with ts-loader

145 Views Asked by At

I have big project and it is running really slow under webpack 5.

I want to pararelize jobs that can be paralelized using thread-loader.

I can't have isolatedModules, we use namespaces and const enums - this can't be changed.

webpack rules for processing tsx/jsx looks like this:

{
            test: /\.tsx?$/,
            exclude: /node_modules/,
            use: [babelLoader, tsLoader],
        },
        {
            test: /\.jsx?$/,
            exclude,
            use: [babelLoader],
        },

}

Acording to the documentation, I can't use thread loader with ts-loader without isolated modules.

Is there any way to force webpack to first use ts-loader (on single thread) and then process the output with babel-loader which is governed by thread-loader ?

Thanks in advance :)

I tried placing it just before babel of course. It seems to work with isolatedModules, but i can't risk that it suddenly will stop working. I read a lot of documentation of webpack and thread-loader but with no luck.

I expect babel loader to be paralelized, and ts-loader working sync.

0

There are 0 best solutions below