Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1e15105

Browse files
kpdeckertimneutkens
authored andcommitted
Output webpack build stats as webpack-stats.json (vercel#2828)
1 parent c927c4f commit 1e15105

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎server/build/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ export default async function build (dir, conf = null) {
1313
const compiler = await webpack(dir, { buildId, buildDir, conf })
1414

1515
try {
16-
await runCompiler(compiler)
17-
await writeBuildStats(buildDir)
16+
conststats=await runCompiler(compiler)
17+
await writeBuildStats(buildDir,stats)
1818
await writeBuildId(buildDir, buildId)
1919
} catch (err) {
2020
console.error(`> Failed to build on ${buildDir}`)
@@ -46,7 +46,7 @@ function runCompiler (compiler) {
4646
})
4747
}
4848

49-
async function writeBuildStats (dir) {
49+
async function writeBuildStats (dir,stats) {
5050
// Here we can't use hashes in webpack chunks.
5151
// That's because the "app.js" is not tied to a chunk.
5252
// It's created by merging a few assets. (commons.js and main.js)
@@ -58,6 +58,9 @@ async function writeBuildStats (dir) {
5858
}
5959
const buildStatsPath = join(dir, '.next', 'build-stats.json')
6060
await fs.writeFile(buildStatsPath, JSON.stringify(assetHashMap), 'utf8')
61+
62+
const statsPath = join(dir, '.next', 'webpack-stats.json')
63+
await fs.writeFile(statsPath, JSON.stringify(stats), 'utf8')
6164
}
6265

6366
async function writeBuildId (dir, buildId) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /