[英]SyntaxError: The requested module 'react-popper' is expected to be of type CommonJS, which does not support named exports
[英]Error using swiperjs React - `The requested module 'react' is expected to be of type CommonJS`
我正在构建一个 React 应用程序。 一般来说,我是 React 和 JS 的新手。
我尝试将
swiperjs<\/code>库导入现有的 React 项目:
import React, { Component } from "react";
import { Swiper, SwiperSlide } from 'swiper/react';
function HomeBanner(props) {
return (
<div >
<div>
<img src="img/slider/home-3/home-banner/1.jpg" alt="" />
<div className="">
<h5>Mega Sale Nov 2019</h5>
<h3>
Double Combo With <br />
The Body Shop
</h3>
<p>Sale up to <strong>50% Off </strong></p>
<a className="ps-btn" href="#">Shop Now</a>
</div>
</div>
<div>
<img src="img/slider/home-3/home-banner/2.jpg" alt="" />
<div className="">
<h5>Mega Sale Nov 2017</h5>
<h3>
IKEA Minimalist <br />
Otoman
</h3>
<p>Discount <strong>50% Off </strong></p>
<a className="ps-btn" href="#">Shop Now</a>
</div>
</div>
</div>
)
}
您的开发环境不支持 ESM 包。 通过运行
node -v<\/code>检查您的 Node 版本。
Node 14 及以上版本支持 ESM 导入。 更新 Node 版本或使用 Swiper 6。
"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.