16.0.0-beta.8
https://github.com/idrunk/vue-loader-bug-reproduction
TypeError: Cannot read property 'content' of null
at Object.selectBlock (D:\Temp\vue3\1\node_modules\vue-loader\dist\select.js:25:45)
at Object.loader (D:\Temp\vue3\1\node_modules\vue-loader\dist\index.js:60:25)
编译通过
编译失败
经过跟踪排查, 发现在前行(index.js:58)插入下述代码, 多次编译都能正常通过, 但我感觉这不是解决之道
if (incomingQuery.type === 'script' && !descriptor.scriptCompiled && descriptor.scriptSetup) {
descriptor.scriptCompiled = compiler_sfc_1.compileScript(descriptor, {
babelParserPlugins: options.babelParserPlugins,
})
}
I'm having the same issue when using the yarn build command
https://github.com/bmunoz89/vue3-playground/
ERROR Failed to compile with 1 errors 10:09:59 PM
error in ./src/views/Experimental.vue?vue&type=script&lang=ts&setup=true
Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
Cannot read property 'content' of null
at PoolWorker.fromErrorObj (/Users/BorisM/Documents/Vue3/vue3-playground/node_modules/thread-loader/dist/WorkerPool.js:262:12)
at /Users/BorisM/Documents/Vue3/vue3-playground/node_modules/thread-loader/dist/WorkerPool.js:204:29
at mapSeries (/Users/BorisM/Documents/Vue3/vue3-playground/node_modules/neo-async/async.js:3625:14)
at PoolWorker.onWorkerMessage (/Users/BorisM/Documents/Vue3/vue3-playground/node_modules/thread-loader/dist/WorkerPool.js:170:35)
at /Users/BorisM/Documents/Vue3/vue3-playground/node_modules/thread-loader/dist/WorkerPool.js:152:14
at Object.selectBlock (/Users/BorisM/Documents/Vue3/vue3-playground/node_modules/vue-loader-v16/dist/select.js:25:45)
at Object.loader (/Users/BorisM/Documents/Vue3/vue3-playground/node_modules/vue-loader-v16/dist/index.js:59:25)
@ ./src/views/Experimental.vue?vue&type=script&lang=ts&setup=true 1:0-388 1:0-388 1:389-766 1:389-766
@ ./src/views/Experimental.vue
@ ./src/router/index.ts
@ ./src/main.ts
@ multi ./src/main.ts
ERROR Build failed with errors.
I'm having the same issue when using the
yarn buildcommandhttps://github.com/bmunoz89/vue3-playground/
ERROR Failed to compile with 1 errors 10:09:59 PM error in ./src/views/Experimental.vue?vue&type=script&lang=ts&setup=true Module build failed (from ./node_modules/thread-loader/dist/cjs.js): Thread Loader (Worker 0) Cannot read property 'content' of null at PoolWorker.fromErrorObj (/Users/BorisM/Documents/Vue3/vue3-playground/node_modules/thread-loader/dist/WorkerPool.js:262:12) at /Users/BorisM/Documents/Vue3/vue3-playground/node_modules/thread-loader/dist/WorkerPool.js:204:29 at mapSeries (/Users/BorisM/Documents/Vue3/vue3-playground/node_modules/neo-async/async.js:3625:14) at PoolWorker.onWorkerMessage (/Users/BorisM/Documents/Vue3/vue3-playground/node_modules/thread-loader/dist/WorkerPool.js:170:35) at /Users/BorisM/Documents/Vue3/vue3-playground/node_modules/thread-loader/dist/WorkerPool.js:152:14 at Object.selectBlock (/Users/BorisM/Documents/Vue3/vue3-playground/node_modules/vue-loader-v16/dist/select.js:25:45) at Object.loader (/Users/BorisM/Documents/Vue3/vue3-playground/node_modules/vue-loader-v16/dist/index.js:59:25) @ ./src/views/Experimental.vue?vue&type=script&lang=ts&setup=true 1:0-388 1:0-388 1:389-766 1:389-766 @ ./src/views/Experimental.vue @ ./src/router/index.ts @ ./src/main.ts @ multi ./src/main.ts ERROR Build failed with errors.
My issue was trigger by the 'cache' option in webpack's config, I saw your project not with webpack, Maybe our issue are different.
@idrunk I made another branch to remove the experimental feature <script setup>, which is the same feature that we are using, and in that branch works without throwing that error.
confirmed same error at vue-cli, setup feature is only support serve mode, not build time.
confirmed same error at
vue-cli,setupfeature is only support serve mode, not build time.
I also have this problem, without typescript
As said in the release note:
<script setup>support is experimental. It does not work well withthread-loader. In Vue CLI, you need to setparallel: falsefor this feature to work correctly.
After setting parallel: false in the vue.config.js I also had to rm node_modules/.cache -rf before building worked again.
This API syntax can only be used after Vue 3.0.3
Most helpful comment
As said in the release note: