Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
8a6307fc
Unverified
Commit
8a6307fc
authored
Oct 30, 2021
by
Tim Neutkens
Committed by
GitHub
Oct 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove isCommonJS check as it has been moved to next-swc (#30677)
Co-authored-by:
JJ Kasper
<
jj@jjsweb.site
>
parent
622a1a55
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
12 deletions
+1
-12
next-swc-loader.js
packages/next/build/webpack/loaders/next-swc-loader.js
+1
-12
No files found.
packages/next/build/webpack/loaders/next-swc-loader.js
View file @
8a6307fc
...
...
@@ -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
,
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment