1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-03 17:59:28 +02:00

Show webpack build progress.

This commit is contained in:
Simo Kinnunen 2014-10-28 20:05:32 +09:00
parent 1fed3b9da5
commit ce948c3a92

View file

@ -1,6 +1,11 @@
var pathutil = require('./lib/util/pathutil') var _ = require('lodash')
var webpack = require('webpack') var webpack = require('webpack')
var CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin') var CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin')
var ProgressPlugin = require('webpack/lib/ProgressPlugin')
var pathutil = require('./lib/util/pathutil')
var log = require('./lib/util/logger').createLogger('webpack:config')
module.exports = { module.exports = {
webpack: { webpack: {
@ -76,13 +81,23 @@ module.exports = {
, ['main'] , ['main']
) )
) )
, new webpack.ResolverPlugin( , new webpack.ResolverPlugin(
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin( new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin(
'.bower.json' '.bower.json'
, ['main'] , ['main']
) )
) )
, new CommonsChunkPlugin('entry/commons.entry.js') , new CommonsChunkPlugin('entry/commons.entry.js')
, new ProgressPlugin(_.throttle(
function(progress, message) {
log.info(
'Build progress %d%% (%s)'
, Math.floor(progress * 100)
, message ? message : (progress >= 1 ? 'complete' : 'unknown')
)
}
, 1000
))
] ]
}, },
webpackServer: { webpackServer: {