Swiper 8 和 Jest (支持 ESM) 必须使用 import 加载 ES 模块 在此处输入图像描述 在 此处输入图像描述
如果我需要保留 swiper 8(不降级),我们该如何解决
我正在尝试在我的 Next.js 项目上设置 firebase 身份验证(使用 TypeScript),并且我相信我遇到了一些与使用 firebase 相关的配置问题,这些问题导致我的 Jest 测试失败。
以下是相关的配置文件:
笑话.config.js:
const nextJest = require("next/jest");
const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: "./",
});
// Add any custom config to be passed to Jest
const customJestConfig = {
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
moduleNameMapper: {
// Handle module aliases (this will be automatically configured for you soon)
"^@/components/(.*)$": "<rootDir>/components/$1",
"^@/pages/(.*)$": "<rootDir>/pages/$1",
},
testEnvironment: "jest-environment-jsdom",
}; …Run Code Online (Sandbox Code Playgroud)