3lang3 / react-vant

React mobile UI Components base on Vant
https://react-vant.3lang.dev
MIT License
1.31k stars 186 forks source link

chore(deps): update @vant/popperjs to v1.3.0 #640

Closed luo3house closed 1 year ago

luo3house commented 1 year ago

@vant/popperjs v1.2.0 开始增加 package.json export 字段以提供包括 nuxt3、vite 在内的大部分打包工具 resolve 模块的指引

@vant/popperjs v1.3.0 相比 v1.2.0 多导出一个 type,看起来对现有仓库无影响

popperjs 用于 Popover 组件

github-actions[bot] commented 1 year ago

PR preview has been successfully built and deployed to https://react-vant-pr-640.surge.sh.

luo3house commented 1 year ago

https://github.com/3lang3/rcdoc/blob/42259534749af87956881aeb9737e9d73dc1b4d2/packages/cli/src/config/vite.package.ts#L40-L41 这里有点问题,node 环境在 cjs 包引用esm,模块必须是 .mjs 结尾,来标识 node 改用不同的规范来加载模块,vite 可以自动选择后缀,但 rcdoc 强制了文件名

3lang3 commented 1 year ago

@luo3house 有本地构建rcdoc然后打包rv 测试过吗

luo3house commented 1 year ago

@luo3house 有本地构建rcdoc然后打包rv 测试过吗

本地 rcdoc build rv 会出现 typescript 语法检查失败,但 check 只涉及 deploy site 所以现有的 pr check 检查都通过

3lang3 commented 1 year ago

@luo3house 有本地构建rcdoc然后打包rv 测试过吗

本地 rcdoc build rv 会出现 typescript 语法检查失败,但 check 只涉及 deploy site 所以现有的 pr check 检查都通过

这次pr是解决@vant/popperjs升级问题,对#638 有影响吗

luo3house commented 1 year ago

this PR + https://github.com/3lang3/rcdoc/pull/18 预期能修复 #638

我在本地测试修改了 rv 产物后缀,并更新popperjs@1.2.0 后能跑起 qwik + rv button

3lang3 commented 1 year ago

this PR + 3lang3/rcdoc#18 预期能修复 #638

我在本地测试修改了 rv 产物后缀,并更新popperjs@1.2.0 后能跑起 qwik + rv button

牛的兄弟,dialog, toast这类呢?

luo3house commented 1 year ago

具体还是要看一下

rcdoc 也要更新下,不然没法正确生成产物,现在的产物 bundler 能识别(不严格后缀检查),node 也能识别(后缀正确),node + es 不能识别(后缀有误),但最后一个挺少见的,一般是 ssr 框架遇到 es 模块时它想把 es 集成进来,于是需要 node + es。

https://remix.run/docs/en/1.16.0/pages/gotchas#importing-esm-packages

3lang3 commented 1 year ago

具体还是要看一下

rcdoc 也要更新下,不然没法正确生成产物,现在的产物 bundler 能识别(不严格后缀检查),node 也能识别(后缀正确),node + es 不能识别(后缀有误),但最后一个挺少见的,一般是 ssr 框架遇到 es 模块时它想把 es 集成进来,于是需要 node + es。

https://remix.run/docs/en/1.16.0/pages/gotchas#importing-esm-packages

最近实在无时间照顾rcdoc那边了,辛苦兄弟有时间跟下这个pr🥹

luo3house commented 1 year ago

测试过 ES 环境下其他依赖也有这个 mjs、cjs 的问题(e.g. @react-spring/web),先关了

另外尝试了 antd 可以,因为 antd 没有写 exports ,而让 node 读取了全量 cjs。如果 rv 指向 cjs 也能在 qwik 跑起来,但不再获得 Tree Shaking。

- import { Button } from 'react-vant'
+ import { Button } from 'react-vant/bundle/react-vant'

所以目前对 qwik 适配比较困难