Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

[问题]小程序原生页面里引用的 npm 模块编译后如何生效 #1748

Closed
cpdeam opened this issue Nov 3, 2021 · 4 comments
Closed
Labels
question Further information is requested

Comments

@cpdeam
Copy link

cpdeam commented Nov 3, 2021

问题描述
小程序原生页面里引用的npm模块,编译后无效,在dist里也找不到

示例代码
源码:

index.config.js
module.exports = {
  usingComponents: {
    login: '@xxx/mini-app-login-component/login/index', // 源码里npm install的包
  },
};
index.wxml
<login></login>

编译后:

index.json:
{
  "usingComponents": {}
}

#762 看这个是已经修复了,还是说原生页面不支持?或者是缺少了哪一步操作吗?

@cpdeam cpdeam added the question Further information is requested label Nov 3, 2021
@cpdeam cpdeam changed the title [问题]小程序自定义组件里引用的 npm 模块编译后如何生效 [问题]小程序原生页面里引用的 npm 模块编译后如何生效 Nov 3, 2021
@watsonhaw5566
Copy link
Contributor

能否提供一小段代码给我测试一下,最好能提供一个复现的仓库。

@Tenodec
Copy link

Tenodec commented Nov 5, 2021

你需要引用dist文件夹下的文件,比如vant 官方例子:"van-calendar": "@vant/weapp/calendar/index",在remax里的原生文件引入:"van-calendar": "@vant/weapp/dist/calendar/index"

@yesmeck
Copy link
Member

yesmeck commented Nov 7, 2021

@cpdeam 提供下可重现的 repo

@cpdeam
Copy link
Author

cpdeam commented Nov 9, 2021

@cpdeam 提供下可重现的 repo

抱歉,已解决,是我们引用的npm模块自身问题。

@cpdeam cpdeam closed this as completed Nov 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants