Unverified Commit c69d7817 authored by Sukka's avatar Sukka Committed by GitHub

chore: enable swc externalHelpers when pre-compile (#38182)

parent b8460266
......@@ -25,6 +25,7 @@ module.exports = function (task) {
const isClient = serverOrClient === 'client'
/** @type {import('@swc/core').Options} */
const swcClientOptions = {
module: {
type: 'commonjs',
......@@ -32,7 +33,7 @@ module.exports = function (task) {
},
jsc: {
loose: true,
externalHelpers: true,
target: 'es2016',
parser: {
syntax: 'typescript',
......@@ -55,6 +56,7 @@ module.exports = function (task) {
},
}
/** @type {import('@swc/core').Options} */
const swcServerOptions = {
module: {
type: 'commonjs',
......@@ -67,7 +69,9 @@ module.exports = function (task) {
},
jsc: {
loose: true,
// Do not enable external helpers on server-side files build
// _is_native_funtion helper is not compatible with edge runtime (need investigate)
externalHelpers: false,
parser: {
syntax: 'typescript',
dynamicImport: true,
......
......@@ -97,6 +97,8 @@ const externals = {
'terser-webpack-plugin':
'next/dist/build/webpack/plugins/terser-webpack-plugin',
// TODO: Add @swc/helpers to externals once @vercel/ncc switch to swc-loader
}
// eslint-disable-next-line camelcase
externals['node-html-parser'] = 'next/dist/compiled/node-html-parser'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment