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
1e151058
Commit
1e151058
authored
Oct 30, 2017
by
Kevin Decker
Committed by
Tim Neutkens
Oct 30, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Output webpack build stats as webpack-stats.json (#2828)
parent
c927c4f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
index.js
server/build/index.js
+6
-3
No files found.
server/build/index.js
View file @
1e151058
...
@@ -13,8 +13,8 @@ export default async function build (dir, conf = null) {
...
@@ -13,8 +13,8 @@ export default async function build (dir, conf = null) {
const
compiler
=
await
webpack
(
dir
,
{
buildId
,
buildDir
,
conf
})
const
compiler
=
await
webpack
(
dir
,
{
buildId
,
buildDir
,
conf
})
try
{
try
{
await
runCompiler
(
compiler
)
const
stats
=
await
runCompiler
(
compiler
)
await
writeBuildStats
(
buildDir
)
await
writeBuildStats
(
buildDir
,
stats
)
await
writeBuildId
(
buildDir
,
buildId
)
await
writeBuildId
(
buildDir
,
buildId
)
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`> Failed to build on
${
buildDir
}
`
)
console
.
error
(
`> Failed to build on
${
buildDir
}
`
)
...
@@ -46,7 +46,7 @@ function runCompiler (compiler) {
...
@@ -46,7 +46,7 @@ function runCompiler (compiler) {
})
})
}
}
async
function
writeBuildStats
(
dir
)
{
async
function
writeBuildStats
(
dir
,
stats
)
{
// Here we can't use hashes in webpack chunks.
// Here we can't use hashes in webpack chunks.
// That's because the "app.js" is not tied to a chunk.
// That's because the "app.js" is not tied to a chunk.
// It's created by merging a few assets. (commons.js and main.js)
// It's created by merging a few assets. (commons.js and main.js)
...
@@ -58,6 +58,9 @@ async function writeBuildStats (dir) {
...
@@ -58,6 +58,9 @@ async function writeBuildStats (dir) {
}
}
const
buildStatsPath
=
join
(
dir
,
'.next'
,
'build-stats.json'
)
const
buildStatsPath
=
join
(
dir
,
'.next'
,
'build-stats.json'
)
await
fs
.
writeFile
(
buildStatsPath
,
JSON
.
stringify
(
assetHashMap
),
'utf8'
)
await
fs
.
writeFile
(
buildStatsPath
,
JSON
.
stringify
(
assetHashMap
),
'utf8'
)
const
statsPath
=
join
(
dir
,
'.next'
,
'webpack-stats.json'
)
await
fs
.
writeFile
(
statsPath
,
JSON
.
stringify
(
stats
),
'utf8'
)
}
}
async
function
writeBuildId
(
dir
,
buildId
)
{
async
function
writeBuildId
(
dir
,
buildId
)
{
...
...
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