Skip to content

Commit

Permalink
chore: restore options to opt-in for server-side transpilation
Browse files Browse the repository at this point in the history
  • Loading branch information
feugy committed Sep 5, 2023
1 parent e117c00 commit e1d2b7b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/next/src/build/swc/jest-transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ const createTransformer: TransformerCreator<
const jestConfig = getJestConfig(jestOptions)

const swcTransformOpts = getJestSWCOptions({
isServer:
jestConfig.testEnvironment === 'node' ||
jestConfig.testEnvironment.includes('jest-environment-node'),
filename,
jsConfig: inputOptions?.jsConfig,
resolvedBaseUrl: inputOptions?.resolvedBaseUrl,
Expand Down
3 changes: 3 additions & 0 deletions packages/next/src/build/swc/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ function getEmotionOptions(
}

export function getJestSWCOptions({
isServer,
filename,
esm,
modularizeImports,
Expand All @@ -247,6 +248,7 @@ export function getJestSWCOptions({
pagesDir,
hasServerComponents,
}: {
isServer: boolean
filename: string
esm: boolean
modularizeImports?: NextConfig['modularizeImports']
Expand All @@ -269,6 +271,7 @@ export function getJestSWCOptions({
jsConfig,
hasServerComponents,
resolvedBaseUrl,
isServerLayer: isServer,
})

const isNextDist = nextDistPath.test(filename)
Expand Down

0 comments on commit e1d2b7b

Please sign in to comment.