小程序错误:Component is not found in path

问题

在使用vant来写小程序的时候,安装官方的方式安装引用:

// index.json
{
  "usingComponents": {
    "van-button": "/miniprogram_npm/vant-weapp/button/index",
  }
}

但是失败了

jsEnginScriptError
Component is not found in path "miniprogram_npm/vant-weapp/button/index"

原因

查找后发现是因为在project.config.json项目的配置中,配置了

{
    "miniprogramRoot": "app/",
}

推测原因,因为小程序把/app当做了主目录,目录外的东西不属于运行时的,所以在查找这个目录之外的 miniprogram_npm 时候失败。

猜你喜欢

转载自www.cnblogs.com/homehtml/p/12693218.html