@bipboys/webpack-stats-plugin
v0.4.6
Published
Stats resolver function for Webpack
Downloads
16
Maintainers
Readme
Stats Resolver for React SSR
Stats resolver function for Webpack
Usage
npm i @bipboys/webpack-stats-plugin
Use "StatsWriterPlugin" for export assets to *.json
const {StatsWriterPlugin} = require('@bipboys/webpack-stats-plugin');
module = {
// webpack config
plugins: [
new StatsWriterPlugin({
filename: 'stats.json',
fields: [
'errors',
'warnings',
'assets',
'hash',
'publicPath',
'outputPath',
'namedChunkGroups'
]
})
]
};
Somewhere in your server:
import {getScripts} from '@bipboys/webpack-stats-plugin';
// Get Scripts and Links from stats.json
const {scriptsAssets, stylesAssets} = await getScripts(manifest, assetName);