Unverified Commit 8a6307fc authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Remove isCommonJS check as it has been moved to next-swc (#30677)

Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
parent 622a1a55
......@@ -40,7 +40,6 @@ function getSWCOptions({
pagesDir,
isNextDist,
hasReactRefresh,
isCommonJS,
}) {
const isTSFile = filename.endsWith('.ts')
const isTypeScript = isTSFile || filename.endsWith('.tsx')
......@@ -77,14 +76,6 @@ function getSWCOptions({
if (isServer) {
return {
jsc,
// Next.js dist intentionally does not have type: commonjs on server compilation
...(isCommonJS
? {
module: {
type: 'commonjs',
},
}
: {}),
// Disables getStaticProps/getServerSideProps tree shaking on the server compilation for pages
disableNextSsg: true,
disablePageConfig: true,
......@@ -103,7 +94,7 @@ function getSWCOptions({
jsc.target = 'es5'
return {
// Ensure Next.js internals are output as commonjs modules
...(isNextDist || isCommonJS
...(isNextDist
? {
module: {
type: 'commonjs',
......@@ -129,7 +120,6 @@ async function loaderTransform(parentTrace, source, inputSourceMap) {
const isPageFile = filename.startsWith(pagesDir)
const isNextDist = nextDistPath.test(filename)
const isCommonJS = source.indexOf('module.exports') !== -1
const swcOptions = getSWCOptions({
pagesDir,
......@@ -138,7 +128,6 @@ async function loaderTransform(parentTrace, source, inputSourceMap) {
isPageFile,
development: this.mode === 'development',
isNextDist,
isCommonJS,
hasReactRefresh,
})
......
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