首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >解决es模块的要求

解决es模块的要求
EN

Stack Overflow用户
提问于 2022-08-05 12:52:19
回答 1查看 177关注 0票数 0

最近,我使用swiperjs在我的remix应用程序中添加了一个旋转木马。它给了我一个错误:

我在如何解决这一问题上寻找不同的解决办法,但都没有奏效。我尝试过的解决办法是:

package.json

  • adding remix.config.js

  • "type":"module"添加"type":"module"

下面是我的remix.config.js的一个例子

代码语言:javascript
复制
/**
 * @type {import('@remix-run/dev').AppConfig}
 */
module.exports = {
  serverDependenciesToBundle: ['swiper', 'swiper/react'],
  serverBuildTarget: 'netlify',
  server: './server.js',
  ignoredRouteFiles: ['**/.*'],
  // appDirectory: "app",
  // assetsBuildDirectory: "public/build",
  // serverBuildPath: ".netlify/functions-internal/server.js",
  // publicPath: "/build/",
};

这是我使用的代码:

代码语言:javascript
复制
import { Swiper, SwiperSlide } from 'swiper/react';
             <Swiper
                spaceBetween={50}
                slidesPerView={3}
                onSlideChange={() => console.log('slide change')}
                onSwiper={(swiper) => console.log(swiper)}>
                <SwiperSlide>Slide 1</SwiperSlide>
                <SwiperSlide>Slide 2</SwiperSlide>
                <SwiperSlide>Slide 3</SwiperSlide>
                <SwiperSlide>Slide 4</SwiperSlide>
              </Swiper>

有谁可以帮我?

EN

回答 1

Stack Overflow用户

发布于 2022-10-12 11:12:53

这个问题的答案是下一个:{ serverDependenciesToBundle: ['swiper', 'swiper/react', 'swiper/react/swiper-react.js', 'ssr-window','ssr-window/ssr-window.esm.js','dom7'], } --这是因为您需要使用esm推送所有库。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73250094

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档