报错如下
[] summer-compiler miss js file, pages/index/components/pulldownRedPacket.js

Error: summer-compiler miss js file, pages/index/components/pulldownRedPacket.js

at SummerCompiler.compileJS (C:\Program Files (x86)\Tencent\微信web开发者工具\code\package.nw\js\common\miniprogram-builder\modules\corecompiler\summerCompiler.js:2:14149)

at runMicrotasks (<anonymous>)

at processTicksAndRejections (node:internal/process/task_queues:96:5)

at async P (C:\Program Files (x86)\Tencent\微信web开发者工具\code\package.nw\core.wxvpkg\f0875bf21bfc4bd87275b7e0fbe7c4f7.js:2:1468)

at async S (C:\Program Files (x86)\Tencent\微信web开发者工具\code\package.nw\core.wxvpkg\f0875bf21bfc4bd87275b7e0fbe7c4f7.js:2:3460)

at async exports.getCompiledJS (C:\Program Files (x86)\Tencent\微信web开发者工具\code\package.nw\core.wxvpkg\f0875bf21bfc4bd87275b7e0fbe7c4f7.js:2:4611)

at async exports.getRuntimeJS (C:\Program Files (x86)\Tencent\微信web开发者工具\code\package.nw\core.wxvpkg\f0875bf21bfc4bd87275b7e0fbe7c4f7.js:2:5363)

at async Proxy.module.exports (C:\Program Files (x86)\Tencent\微信web开发者工具\code\package.nw\core.wxvpkg\bb2c2114b22d4af48ec81b0c1257b0f8.js:2:437)

at async C:\Program Files (x86)\Tencent\微信web开发者工具\code\package.nw\core.wxvpkg\495e925a533a66fcf52d8322e2c7e133.js:2:4822

at async exports.getJsResource (C:\Program Files (x86)\Tencent\微信web开发者工具\code\package.nw\core.wxvpkg\495e925a533a66fcf52d8322e2c7e133.js:2:4787)(env: Windows,mp,2.01.2510270; lib: 3.11.3)

两个同页面中的组件引用相同的index文件会触发这个问题
在组件中注释// import { RedPacketType } from './index'后解决了问题

原因是:ep-red-packet-type-selector/index.vue 里这句 不是 type-only 的导入,会被当作运行时依赖打进小程序产物。由于它指向同目录的 index.ts,而该目录里又有 index.vue(组件本体),小程序构建阶段会出现“同名入口/输出冲突”或解析歧义,最终导致编译失败,页面 JS 未产出,于是报 miss js file。

你把这行注释掉后,运行时依赖被移除,构建不再处理该 index.ts,冲突消失,所以问题看起来“解决了”。

一句话:这不是 RedPacketType 本身有问题,而是 index.vue 与 index.ts 同名导致的构建路径冲突,在非 type 导入时被触发

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐