thread-loader icon indicating copy to clipboard operation
thread-loader copied to clipboard

the option of vue-loader will be missing when use thread-loader

Open smiledingvip opened this issue 5 years ago • 3 comments

when i use both of the vue-loader and thread-loader, for some reasons, the vue-loader is not directly in ./node_modules, so i have to manually set the one of the option values of the vue-loader which is called compile,like: { test: /\.vue$/, use: [ 'thread-loader', 'cache-loader', { loader: 'vue-loader', options: { compiler: require('./node_modules/@weiyi/hammer/vue-template-compiler') } } ] }, then there are some mistakes Thread Loader (Worker 0) compiler.parseComponent is not a function at PoolWorker.fromErrorObj (D:\dingnan\vue-thread-loader\node_modules\thread-loader\dist\WorkerPool.js:262:12) at D:\dingnan\vue-thread-loader\node_modules\thread-loader\dist\WorkerPool.js:204:29 at mapSeries (D:\dingnan\vue-thread-loader\node_modules\neo-async\async.js:3625:14) at parse (D:\dingnan\vue-thread-loader\node_modules\@vue\component-compiler-utils\dist\parse.js:14:23) at Object.module.exports (D:\dingnan\vue-thread-loader\node_modules\vue-loader\lib\index.js:69:22) @ ./src/main.js 2:0-28 7:13-16 these mistakes above will not be appear when not using thread-loader,and i find the compile will be an empty object when using thread-loader, so i suppose it's a bug,i don't know how to do, can someone who can help me? thanks a lot! @ericclemmons @sapegin @MoOx

smiledingvip avatar Apr 12 '20 14:04 smiledingvip

Sorry I have no idea, I don't use any of this loader, nor webpack this days. Not sure why you poke me, but please try to not kind of randomly poke some open source maintainers.

MoOx avatar Apr 12 '20 16:04 MoOx

@smiledingvip you cannot use the compiler option when using thread-loader because its value is a function. Loader options need to be serialized so they can be passed into the workers, which will not work for functions. Also see #75

@MoOx i guess he pinged you because you are a member of webpack-contrib, which this repo belongs to.

janvennemann avatar May 14 '20 13:05 janvennemann

@janvennemann Am I correct to say that each threads created by thread-loader will indeed all read and utilize the options passed into each loader, e.g. babel-loader, that comes after thread-loader in webpack.config.js? I also created an issue regarding this, could you take a look?

nyngwang avatar Mar 14 '24 23:03 nyngwang