Skip to content

Commit 081c21b

Browse files
authored
Revert "Enable externalHelpers when pre compiling Next.js' code" (#37829)
Revert "Enable `externalHelpers` when pre compiling Next.js' code (#37164)" This reverts commit 4671010.
1 parent d6fb833 commit 081c21b

File tree

4 files changed

+51
-55
lines changed

4 files changed

+51
-55
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"@next/swc": "workspace:*",
6868
"@svgr/webpack": "5.5.0",
6969
"@swc/cli": "0.1.55",
70-
"@swc/core": "1.2.203",
70+
"@swc/core": "1.2.148",
7171
"@swc/helpers": "0.3.17",
7272
"@testing-library/react": "13.0.0",
7373
"@types/cheerio": "0.22.16",

packages/next/taskfile-swc.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,14 @@ module.exports = function (task) {
2525

2626
const isClient = serverOrClient === 'client'
2727

28-
/** @type {import('@swc/core').Options} */
2928
const swcClientOptions = {
3029
module: {
3130
type: 'commonjs',
3231
ignoreDynamic: true,
3332
},
3433
jsc: {
3534
loose: true,
36-
externalHelpers: true,
35+
3736
target: 'es2016',
3837
parser: {
3938
syntax: 'typescript',
@@ -56,7 +55,6 @@ module.exports = function (task) {
5655
},
5756
}
5857

59-
/** @type {import('@swc/core').Options} */
6058
const swcServerOptions = {
6159
module: {
6260
type: 'commonjs',
@@ -69,9 +67,7 @@ module.exports = function (task) {
6967
},
7068
jsc: {
7169
loose: true,
72-
// Do not enable externalHelpers for server-side code
73-
// "_is_native_function.mjs" helper is not compatible with edge runtime
74-
externalHelpers: false,
70+
7571
parser: {
7672
syntax: 'typescript',
7773
dynamicImport: true,

packages/next/taskfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,7 +1956,7 @@ export async function shared(task, opts) {
19561956
.source(
19571957
opts.src || 'shared/**/!(amp|config|constants|dynamic|head).+(js|ts|tsx)'
19581958
)
1959-
.swc('client', { dev: opts.dev })
1959+
.swc('server', { dev: opts.dev })
19601960
.target('dist/shared')
19611961
notify('Compiled shared files')
19621962
}
@@ -1966,7 +1966,7 @@ export async function shared_re_exported(task, opts) {
19661966
.source(
19671967
opts.src || 'shared/**/{amp,config,constants,dynamic,head}.+(js|ts|tsx)'
19681968
)
1969-
.swc('client', { dev: opts.dev, interopClientDefaultExport: true })
1969+
.swc('server', { dev: opts.dev, interopClientDefaultExport: true })
19701970
.target('dist/shared')
19711971
notify('Compiled shared re-exported files')
19721972
}

pnpm-lock.yaml

Lines changed: 46 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)