webpack thread-loader with ts-loader
Asked Answered
F

1

8

I have the following rule in my webpack config:

       {
            test: /(\.tsx?)$/,
            use: [{
                loader: 'thread-loader'
            },
            {
                loader: 'ts-loader',
                options: {
                    transpileOnly: true,
                    appendTsSuffixTo: [/\.vue$/]
                }
            }]
        }

This results in:

ERROR in ./plugins/axios.ts
Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 9)
Cannot read property 'errors' of undefined

It works fine when I remove the thread-loader.

Fluoride answered 29/9, 2018 at 17:2 Comment(0)
M
14

According to the example on github, you need to set the happyPackMode option on the ts-loader to true. I've came across with the same problem you described, and this made it work.

Miltie answered 21/11, 2018 at 12:15 Comment(2)
But this stops throwing syntactic typescript errors to webpack, which is problematicLevantine
@Levantine The fix is mentioned in HappyPack's Documentation. Note, however, that both HappyPack and ThreadLoader are deprecated in Webpack 5.Pegpega

© 2022 - 2024 — McMap. All rights reserved.