@@ -13,8 +13,8 @@ export default async function build (dir, conf = null) {
13
13
const compiler = await webpack ( dir , { buildId, buildDir, conf } )
14
14
15
15
try {
16
- await runCompiler ( compiler )
17
- await writeBuildStats ( buildDir )
16
+ const stats = await runCompiler ( compiler )
17
+ await writeBuildStats ( buildDir , stats )
18
18
await writeBuildId ( buildDir , buildId )
19
19
} catch ( err ) {
20
20
console . error ( `> Failed to build on ${ buildDir } ` )
@@ -46,7 +46,7 @@ function runCompiler (compiler) {
46
46
} )
47
47
}
48
48
49
- async function writeBuildStats ( dir ) {
49
+ async function writeBuildStats ( dir , stats ) {
50
50
// Here we can't use hashes in webpack chunks.
51
51
// That's because the "app.js" is not tied to a chunk.
52
52
// It's created by merging a few assets. (commons.js and main.js)
@@ -58,6 +58,9 @@ async function writeBuildStats (dir) {
58
58
}
59
59
const buildStatsPath = join ( dir , '.next' , 'build-stats.json' )
60
60
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' )
61
64
}
62
65
63
66
async function writeBuildId ( dir , buildId ) {
0 commit comments