ant-design / ant-design-mobile

Essential UI blocks for building mobile web apps.
https://mobile.ant.design
MIT License
11.59k stars 2.39k forks source link

版本更新后webpack报错 #5452

Closed wwb-xigua closed 2 years ago

wwb-xigua commented 2 years ago

Version of antd-mobile

5.16.1

Operating system and its version

Others

Browser and its version

No response

Sandbox to reproduce

No response

What happened?

升级了版本,从2.3.4->5.16.1, 需求:同时保留了两个版本 方法: "antd-mobile": "^5.16.1", "antd-mobile-v2": "^2.3.4",

impot {***} from 'antd-mobile' 错误:导入插件的时候找不到lib文件(node-modules)

尝试:手动修改了webpack中 { libraryName: "antd-mobile", libraryDirectory: 'es', style: true }

第二报错

image

Relevant log output

No response

IronKinoko commented 2 years ago

按需加载请看这里 https://mobile.ant.design/zh/guide/import-on-demand/#%E6%8C%89%E9%9C%80%E5%8A%A0%E8%BD%BD

miracles1919 commented 2 years ago

可以把你的项目打个 zip 发到这里,不然没有办法排查

wwb-xigua commented 2 years ago

加载-E6加载请看这里https://mobileant.design/zh/guide/import-on demand/#%E%8C%89%9%9C%80%E%A0%E8%BD% BD

我按照文档添加了入口与query,本地运行没有问题,打包的时候出现以上找不到antd-mobile/lib/***

以下是图样 1.webpack

image

2.main.jsx

image

3.组件的使用

image
IronKinoko commented 2 years ago

你的截图没有看出问题。可以把你的项目打个 zip 发到这里,不然没有办法排查

wwb-xigua commented 2 years ago

可以把你的项目打个 zip 发到这里,不然没有办法排查

你的截图没有看出问题。可以把你的项目打个 zip 发到这里,不然没有办法排查

项目超过25m 无法使用评论提交

IronKinoko commented 2 years ago

可以将代码提交到一个新仓库,方便我们 clone

IronKinoko commented 2 years ago

请提交到github。。。。你这链接还需要登录验证

wwb-xigua commented 2 years ago

请提交到github。。。。你这链接还需要登录验证

https://github.com/wwb-xigua/--bug.git

IronKinoko commented 2 years ago

webpack.prod.js 文件里的配置没有修改

wwb-xigua commented 2 years ago

好的,但是仅仅引用了空组件就会报错

image

image

bearguo commented 2 years ago

好的,但是仅仅引用了空组件就会报错 image

image

tabs组件会出现这个问题,我也复现了

IronKinoko commented 2 years ago

@bearguo 提供一下最小复现代码

github-actions[bot] commented 2 years ago

Hi, wwb-xigua.

It seems that this issue is a bit vague and lacks some necessary information. It is recommended to read How To Ask Questions The Smart Way.

看起来这条 issue 描述得有些模糊,缺少一些必要的信息,推荐阅读一下提问指引

awmleer commented 2 years ago

@wwb-xigua 你的问题看起来 @IronKinoko 已经在这里回复了

@bearguo 如果你还遇到了类似的问题,可以考虑单独再提个 issue,并且附上复现 demo