Created
June 14, 2016 15:22
-
-
Save michaelgilley/2d11ae12edfd567dabd93237b596fb76 to your computer and use it in GitHub Desktop.
Snippet for grabbing Webpack stats in JSON format when using the Node API.
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
import webpack from 'webpack' | |
import {writeFileSync} from 'fs' | |
import {resolve} from 'path' | |
import config from 'webpack.config.js' | |
import webpackDevServer from 'webpack-dev-server' | |
config.profile = true | |
const compiler = webpack(config) | |
compiler.plugin('done', (stats) => { | |
writeFileSync(resolve('./stats.json'), JSON.stringify(stats.toJson()), 'utf8') | |
}) | |
webpackDevServer(compiler, { | |
hot: true, | |
inline: true, | |
stats: { | |
colors: true | |
}, | |
publicPath: config.output.publicPath | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment