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
b02df3f4
Unverified
Commit
b02df3f4
authored
Jan 17, 2021
by
Tobias Koppers
Committed by
GitHub
Jan 17, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve splitChunks config for webpack 5 (#21208)
parent
9c4d3684
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
27 deletions
+64
-27
webpack-config.ts
packages/next/build/webpack-config.ts
+30
-27
stats-config.js
test/.stats-app/stats-config.js
+34
-0
No files found.
packages/next/build/webpack-config.ts
View file @
b02df3f4
...
@@ -434,17 +434,11 @@ export default async function getBaseWebpackConfig(
...
@@ -434,17 +434,11 @@ export default async function getBaseWebpackConfig(
cacheGroups
:
{
cacheGroups
:
{
default
:
false
,
default
:
false
,
vendors
:
false
,
vendors
:
false
,
// In webpack 5 vendors was renamed to defaultVendors
defaultVendors
:
false
,
},
},
},
},
prodGranular
:
{
prodGranular
:
{
chunks
:
'all'
,
chunks
:
'all'
,
cacheGroups
:
{
cacheGroups
:
{
default
:
false
,
vendors
:
false
,
// In webpack 5 vendors was renamed to defaultVendors
defaultVendors
:
false
,
framework
:
{
framework
:
{
chunks
:
'all'
,
chunks
:
'all'
,
name
:
'framework'
,
name
:
'framework'
,
...
@@ -458,10 +452,13 @@ export default async function getBaseWebpackConfig(
...
@@ -458,10 +452,13 @@ export default async function getBaseWebpackConfig(
enforce
:
true
,
enforce
:
true
,
},
},
lib
:
{
lib
:
{
test
(
module
:
{
size
:
Function
;
identifier
:
Function
}):
boolean
{
test
(
module
:
{
size
:
Function
nameForCondition
:
Function
}):
boolean
{
return
(
return
(
module
.
size
()
>
160000
&&
module
.
size
()
>
160000
&&
/node_modules
[/\\]
/
.
test
(
module
.
identifier
()
)
/node_modules
[/\\]
/
.
test
(
module
.
nameForCondition
()
||
''
)
)
)
},
},
name
(
module
:
{
name
(
module
:
{
...
@@ -493,6 +490,11 @@ export default async function getBaseWebpackConfig(
...
@@ -493,6 +490,11 @@ export default async function getBaseWebpackConfig(
minChunks
:
totalPages
,
minChunks
:
totalPages
,
priority
:
20
,
priority
:
20
,
},
},
...(
isWebpack5
?
undefined
:
{
default
:
false
,
vendors
:
false
,
shared
:
{
shared
:
{
name
(
module
,
chunks
)
{
name
(
module
,
chunks
)
{
return
(
return
(
...
@@ -513,6 +515,7 @@ export default async function getBaseWebpackConfig(
...
@@ -513,6 +515,7 @@ export default async function getBaseWebpackConfig(
minChunks
:
2
,
minChunks
:
2
,
reuseExistingChunk
:
true
,
reuseExistingChunk
:
true
,
},
},
}),
},
},
maxInitialRequests
:
25
,
maxInitialRequests
:
25
,
minSize
:
20000
,
minSize
:
20000
,
...
...
test/.stats-app/stats-config.js
View file @
b02df3f4
...
@@ -135,5 +135,39 @@ module.exports = {
...
@@ -135,5 +135,39 @@ module.exports = {
},
},
],
],
},
},
{
title
:
'Webpack 5 Mode'
,
diff
:
'onOutputChange'
,
renames
,
configFiles
:
[
{
path
:
'next.config.js'
,
content
:
`
module.exports = {
generateBuildId: () => 'BUILD_ID',
future: {
webpack5: true
}
}
`
,
},
],
filesToTrack
:
clientGlobs
,
// will be output to fetched-pages/${pathname}.html
pagesToFetch
:
[
'http://localhost:$PORT/'
,
'http://localhost:$PORT/link'
,
'http://localhost:$PORT/withRouter'
,
],
pagesToBench
:
[
'http://localhost:$PORT/'
,
'http://localhost:$PORT/error-in-render'
,
],
benchOptions
:
{
reqTimeout
:
60
,
concurrency
:
50
,
numRequests
:
2500
,
},
},
],
],
}
}
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