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.
First, for ts-loader to produce sourcemaps, you will need to set the tsconfig.
Webpack compiles a TypeScript file using ts-loader package which asks TSC to do the compilation. The result of this compilation will be JavaScript code that will be used to make a bundle.
Disclaimer: thread-loader is a third-party package maintained by community members, it potentially does not have the same support, security policy or license as webpack, and it is not maintained by webpack. Runs the following loaders in a worker pool.
source-map-loader allows webpack to maintain source map data continuity across libraries so ease of debugging is preserved. The source-map-loader will extract from any JavaScript file, including those in the node_modules directory.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With