jd-opensource / jd-opensource/taro-ui

用rollup打包组件库,打包后的文件引用Taro下的api,默认加了一级default,类似于Taro.makePhoneCall打完包后就变成了Taro.default.makePhoneCall,但是Taro.default下面没有makePhoneCall这个方法,还有一些api也不行。

Open
#1,418 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.7k
Forks
740
PR merge metrics
No merged PRs in 30d

Description

**问题描述**
用rollup打包组件库,打包后的文件引用Taro下的api,默认加了一级default,类似于Taro.makePhoneCall打完包后就变成了Taro.default.makePhoneCall,但是Taro.default下面没有makePhoneCall这个方法,还有一些api也不行。

**复现步骤**

ca4c0505940a0fa4ff9181239e81cc8

**期望行为**
期望组件库中也能够正常调用

**报错信息**
MiniProgramError
TypeError: i.a.getStorageSync is not a function

**系统信息**
👽 Taro v3.3.10

Taro CLI 3.3.10 environment info:
System:
OS: Windows 10
Binaries:
Node: 14.17.6 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - D:\User\hliu\AppData\Roaming\npm\yarn.CMD
npm: 6.14.15 - C:\Program Files\nodejs\npm.CMD

**补充信息**
Taro下面有default,但是default里面的方法较少,不全,导致引用就报不是一个方法

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.