找不到模块:错误:包路径 ./react/swiper-react 未从包中导出
我升级到react-scripts v5,并且收到以下错误:
这是我的导入基于 Swiper 文档:
import { Swiper, SwiperSlide } from 'swiper/react/swiper-react';
import 'swiper/swiper-bundle.min.css';
import 'swiper/swiper.min.css';
I upgraded to react-scripts v5, and I'm getting these errors:
This is how my imports look based on Swiper documentation:
import { Swiper, SwiperSlide } from 'swiper/react/swiper-react';
import 'swiper/swiper-bundle.min.css';
import 'swiper/swiper.min.css';
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
更改
源
https://github.com/nolimits4web/swiper/issues/4003
Change
to
source
https://github.com/nolimits4web/swiper/issues/4003
添加到 Rafal 发布的内容中,您的问题的另一个解决方案可能是更改以下行。
根据您使用的技术,导入 Swiper .css 有多种不同的方法。
如果您阅读官方文档: https://ionicframework.com/docs/react/slides
你可以看到导入CSS的所有不同方式
因此,在我在 Ionic 中开发应用程序的情况下,我的导入将如下所示:
还有其他选项,具体取决于您设计工作表的样式。
希望有帮助!
Adding to what Rafal posted, another fix to your issue could be changing the following line
There are various different ways of importing the Swiper .css depending on what technologies you are using.
If you read the official documentation: https://ionicframework.com/docs/react/slides
you can see all the different ways of importing the css
So in my case where I am developing my app in Ionic, my import would look like this:
There are other options as well depending on how you are styling your sheets.
Hope it helps!
我这样做了:
忽略 eslint 问题似乎可以使其工作。
I did this:
Ignoring the eslint issues seems to make it work.