Skip to content

Commit

Permalink
Revert "Enable externalHelpers when pre compiling Next.js' code (#3…
Browse files Browse the repository at this point in the history
…7164)"

This reverts commit 4671010.
  • Loading branch information
ijjk authored Jun 19, 2022
1 parent d6fb833 commit fbcc207
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 55 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@next/swc": "workspace:*",
"@svgr/webpack": "5.5.0",
"@swc/cli": "0.1.55",
"@swc/core": "1.2.203",
"@swc/core": "1.2.148",
"@swc/helpers": "0.3.17",
"@testing-library/react": "13.0.0",
"@types/cheerio": "0.22.16",
Expand Down
8 changes: 2 additions & 6 deletions packages/next/taskfile-swc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ module.exports = function (task) {

const isClient = serverOrClient === 'client'

/** @type {import('@swc/core').Options} */
const swcClientOptions = {
module: {
type: 'commonjs',
ignoreDynamic: true,
},
jsc: {
loose: true,
externalHelpers: true,

target: 'es2016',
parser: {
syntax: 'typescript',
Expand All @@ -56,7 +55,6 @@ module.exports = function (task) {
},
}

/** @type {import('@swc/core').Options} */
const swcServerOptions = {
module: {
type: 'commonjs',
Expand All @@ -69,9 +67,7 @@ module.exports = function (task) {
},
jsc: {
loose: true,
// Do not enable externalHelpers for server-side code
// "_is_native_function.mjs" helper is not compatible with edge runtime
externalHelpers: false,

parser: {
syntax: 'typescript',
dynamicImport: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/next/taskfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1956,7 +1956,7 @@ export async function shared(task, opts) {
.source(
opts.src || 'shared/**/!(amp|config|constants|dynamic|head).+(js|ts|tsx)'
)
.swc('client', { dev: opts.dev })
.swc('server', { dev: opts.dev })
.target('dist/shared')
notify('Compiled shared files')
}
Expand All @@ -1966,7 +1966,7 @@ export async function shared_re_exported(task, opts) {
.source(
opts.src || 'shared/**/{amp,config,constants,dynamic,head}.+(js|ts|tsx)'
)
.swc('client', { dev: opts.dev, interopClientDefaultExport: true })
.swc('server', { dev: opts.dev, interopClientDefaultExport: true })
.target('dist/shared')
notify('Compiled shared re-exported files')
}
Expand Down
92 changes: 46 additions & 46 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fbcc207

Please sign in to comment.