Next.jsjest
jestesbuild-jest@swc/jestNext.jsesbuild-jest
esbuildreact17automatic JSX runtime
>The React 17 JSX transform seems more complicated and React-specific then the standard JSX transform, so I'm not sure it's something I'm going to include in esbuild's core.
miyamonz

@swc/jest
swc

jest
$ npx create-next-app --ts
next 11.1.2
moduleNameMapper: {
// Handle CSS imports (with CSS modules)
// https://jestjs.io/docs/webpack#mocking-css-modules
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy',
// Handle CSS imports (without CSS modules)
'^.+\\.(css|sass|scss)$': '<rootDir>/__mocks__/styleMock.js',
// Handle image imports
// https://jestjs.io/docs/webpack#handling-static-assets
'^.+\\.(jpg|jpeg|png|gif|webp|svg)$': `<rootDir>/__mocks__/fileMock.js`,
// Handle module aliases
'^@/components/(.*)$': '<rootDir>/components/$1',
},
moduleNameMapper
identity-obj-proxycss
css import
__mocks__使
create-next-appwith css modules

swc/jestnext.jsjest

Next.jsswc使
Next11.1