Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/next/taskfile-swc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ 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 @@ -55,6 +56,7 @@ module.exports = function (task) {
},
}

/** @type {import('@swc/core').Options} */
const swcServerOptions = {
module: {
type: 'commonjs',
Expand All @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions packages/next/taskfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,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'
Expand Down