Applet error: Component is not found in path

problem

When using vantto write small programs, install the official way to install references:

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

but failed

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

the reason

After searching, it is found that because project.config.jsonof the configuration in the project configuration,

{
    "miniprogramRoot": "app/",
}

Speculate the reason, because the applet is regarded /appas the main directory, and the things outside the directory do not belong to the runtime, so it fails when looking for miniprogram_npm outside this directory.

Guess you like

Origin www.cnblogs.com/homehtml/p/12693218.html