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
0c85bd01
Commit
0c85bd01
authored
Sep 30, 2022
by
Tim Neutkens
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'canary' of github.com:vercel/next.js into canary
parents
a78ce92e
b806985f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
9 deletions
+18
-9
webpack-config.ts
packages/next/build/webpack-config.ts
+15
-6
config-schema.ts
packages/next/server/config-schema.ts
+1
-1
config-shared.ts
packages/next/server/config-shared.ts
+1
-1
next.config.js
test/e2e/app-dir/rsc-basic/next.config.js
+1
-1
No files found.
packages/next/build/webpack-config.ts
View file @
0c85bd01
...
...
@@ -124,6 +124,12 @@ function errorIfEnvConflicted(config: NextConfigComplete, key: string) {
}
}
function
isResourceInPackages
(
resource
:
string
,
packageNames
?:
string
[])
{
return
packageNames
?.
some
((
p
:
string
)
=>
new
RegExp
(
'[/
\\\\
]node_modules[/
\\\\
]'
+
p
+
'[/
\\\\
]'
).
test
(
resource
)
)
}
export
function
getDefineEnv
({
dev
,
config
,
...
...
@@ -1137,8 +1143,9 @@ export default async function getBaseWebpackConfig(
if
(
layer
===
WEBPACK_LAYERS
.
server
)
{
// All packages should be bundled for the server layer if they're not opted out.
if
(
config
.
experimental
.
optoutServerComponentsBundle
?.
some
((
p
:
string
)
=>
new
RegExp
(
'node_modules[/
\\\\
]'
+
p
+
'[/
\\\\
]'
).
test
(
res
)
isResourceInPackages
(
res
,
config
.
experimental
.
serverComponentsExternalPackages
)
)
{
return
`
${
externalType
}
${
request
}
`
...
...
@@ -1514,16 +1521,18 @@ export default async function getBaseWebpackConfig(
{
issuerLayer
:
WEBPACK_LAYERS
.
server
,
test
:
(
req
:
string
)
=>
{
// If it's not a source code file, or has been opted out of
// bundling, don't resolve it.
if
(
!
codeCondition
.
test
.
test
(
req
)
||
config
.
experimental
.
optoutServerComponentsBundle
?.
some
(
(
mod
)
=>
{
return
req
.
includes
(
'/node_modules/'
+
mod
+
'/'
)
}
isResourceInPackages
(
req
,
config
.
experimental
.
serverComponentsExternalPackages
)
)
{
return
false
}
return
true
},
resolve
:
process
.
env
.
__NEXT_REACT_CHANNEL
...
...
packages/next/server/config-schema.ts
View file @
0c85bd01
...
...
@@ -323,7 +323,7 @@ const configSchema = {
optimisticClientCache
:
{
type
:
'boolean'
,
},
optoutServerComponentsBundle
:
{
serverComponentsExternalPackages
:
{
items
:
{
type
:
'string'
,
},
...
...
packages/next/server/config-shared.ts
View file @
0c85bd01
...
...
@@ -154,7 +154,7 @@ export interface ExperimentalConfig {
adjustFontFallbacksWithSizeAdjust
?:
boolean
// A list of packages that should be treated as external in the RSC server build
optoutServerComponentsBundle
?:
string
[]
serverComponentsExternalPackages
?:
string
[]
fontLoaders
?:
{
[
fontLoader
:
string
]:
any
}
}
...
...
test/e2e/app-dir/rsc-basic/next.config.js
View file @
0c85bd01
...
...
@@ -5,7 +5,7 @@ module.exports = {
},
experimental
:
{
appDir
:
true
,
optoutServerComponentsBundle
:
[
'conditional-exports-optout'
],
serverComponentsExternalPackages
:
[
'conditional-exports-optout'
],
},
rewrites
:
async
()
=>
{
return
{
...
...
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