小程序预览白屏报错 “module “dist/packages/@zanui/noticebar/index“ is not defined”

时间:2024-03-13 17:40:14

问题描述:

微信开发工具编译运行没问题、真机调试也没问题,但是预览模式下手机扫码后小程序白屏、版本提交审核也没通过。

小程序预览白屏报错 “module “dist/packages/@zanui/noticebar/index“ is not defined”

从网上也几乎找不到答案,于是自己尝试分析解决,记录下来供读者朋友参考。

 

解决过程:

1.打开手机小程序的调试模式

点击小程序页面右上角三个点,在弹出层页面点击开发和调试,然后选择启动debug,具体操作如下图:

小程序预览白屏报错 “module “dist/packages/@zanui/noticebar/index“ is not defined”小程序预览白屏报错 “module “dist/packages/@zanui/noticebar/index“ is not defined”小程序预览白屏报错 “module “dist/packages/@zanui/noticebar/index“ is not defined”

 

 

2.重新扫码预览,检查console日志

检查发现,一直在报这个错:

小程序预览白屏报错 “module “dist/packages/@zanui/noticebar/index“ is not defined”

MiniProgramError
Error: module "dist/packages/@zanui/noticebar/index" is not defined
0l10 UUS10U
DigiCert Inc10Uwww.digicert.com1+0)U"DigiCert High Assurance EV Root CA?:19
SystemError (appServiceSDKScriptError)
SubContext evaluateScriptFile "app-service.js" failed: error code 0
Error: SubContext evaluateScriptFile "app-service.js" failed: error code 0
at s.value (WAServiceMainContext.js:2:149788)
at WAServiceMainContext.js:2:152279
at Array.forEach (<anonymous>)
at WAServiceMainContext.js:2:152257
at h (WAServiceMainContext.js:2:81693)
at Object.g [as onReady] (WAServiceMainContext.js:2:81943)
at a (WAServiceMainContext.js:2:151382)
at Function.<anonymous> (WAServiceMainContext.js:2:152837)
at WAServiceMainContext.js:2:143234
at WAServiceMainContext.js:2:252383

 错误描述里边居然报zanui的错,但是这个从引入后没做过任何改动啊,怀疑应该是类似编译增强、混淆编译之类的配置错,经过一番变更再测试还是问题依旧,于是就顺着提示的路径“dist/packages/@zanui/noticebar/index” 去找,看看是不是有什么端倪,挨个文件打开看了下,发现也就index.json 看着有点奇怪,有些多余,里边只有{},于是尝试直接把index.json文件删了,重新编译、预览,居然奇迹般正常了,

 

3.删除 dist/packages/@zanui/noticebar/index.json

小程序预览白屏报错 “module “dist/packages/@zanui/noticebar/index“ is not defined”

 

重新扫码预览、正常了!!