app.json 中声明通过 npm 安装的自定义组件,真机报错“组件路径错误”
问题:
在 app.json 中声明通过 npm 安装的自定义组件,在开发者工具上表现正常,但在真机上会报错 Component is not found in path xxx
只有在相关页面的 json 文件中声明才没问题。
// app.json{ //... "usingComponents": { "applyComponent": "wx-library/components/apply/index", "cityComponent": "wx-library/components/city/index", "promptComponent": "wx-library/components/prompt/index" }} |
文件路径:
seo-sell
├─ miniprogram_npm
│ └─ wx-library
│ ├─ common
│ ├─ components
│ └─ index.js
├─ app.json
