简体   繁体   中英

webpack thread-loader with ts-loader

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM