Last active
April 4, 2020 15:30
-
-
Save NateScarlet/48f2bd40299c9c72b50a12fbd946b94c to your computer and use it in GitHub Desktop.
Use html-webpack-plugin to generate stats.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new HtmlPlugin({ | |
/** @param {{compilation: import('webpack').compilation.Compilation}} */ | |
templateContent: ({ compilation }) => { | |
const { | |
hash, | |
publicPath, | |
assetsByChunkName, | |
assets, | |
} = compilation.getStats().toJson({ all: true }, true); | |
return JSON.stringify( | |
{ hash, publicPath, assetsByChunkName, assets }, | |
undefined, | |
4 | |
); | |
}, | |
inject: false, | |
minify: false, | |
filename: "stats.json", | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment