Js与ts混用打包问题
发布于 3 年前 作者 huaer 2194 次浏览 来自 问答
粉丝福利 : 关注VUE中文社区公众号,回复视频领取粉丝福利

求助! 已经卡了一个礼拜了…
现在有 vue-cli 构建的老项目(js 项目), 因为需求, 需要引入 typescript
目前引入 ts 之后, 根据 vue-cli 官网的相关配置可以使用 npm run serve 启动项目。
但是在打包 npm run build 过程中发生错误。错误信息如下:

 ERROR  Failed to compile with 1 errors                                                                                              14:48:46

Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
Cannot read property 'hooks' of undefined
    at PoolWorker.fromErrorObj (/Users/yyyyy/Desktop/work/systems/client/node_modules/thread-loader/dist/WorkerPool.js:262:12)
    at /Users/yyyyy/Desktop/work/systems/client/node_modules/thread-loader/dist/WorkerPool.js:204:29
    at successfulTypeScriptInstance (/Users/yyyyy/Desktop/work/systems/client/node_modules/ts-loader/dist/instances.js:159:27)
    at Object.getTypeScriptInstance (/Users/yyyyy/Desktop/work/systems/client/node_modules/ts-loader/dist/instances.js:34:12)
    at Object.loader (/Users/yyyyy/Desktop/work/systemsclient/node_modules/ts-loader/dist/index.js:17:41)
回到顶部