javascript - Gulp webpack-dev-server: callback before bundle is finished -
i'm trying add callback webpack-dev-server module in gulp. callback has goal notify users url dev server started. issue callback invoked before bundling process finishes.
if add fixed timeout works, undesired.
question: doing wrong callback structure? why being called before bundle finished?
my code in gulp:
var server = new webpackdevserver(webpack(devwebpackconfig), devserverconfig); server.listen(options.devserverport || 8080, 'localhost', function(err) { if(err) { console.error('[webpack-dev-server] failed start:', err); } else { console.log('[webpack-dev-server] started:', 'browse http://localhost:'+ options.devserverport +'/webpack-dev-server/'); } });
current output:
[14:43:43] finished 'dev' after 66 ms [webpack-dev-server] started: browse http://localhost:8002/webpack-dev-server/ hash: 638bdaa3201a4220c58e version: webpack 1.9.5 time: 7315ms asset size chunks chunk names c91905265455192ab6ea13d95c9edc63.woff 42.6 kb [emitted] b09bad3c727751c808f224df00c208f8.woff 99.6 kb [emitted] index.js 4.83 mb 0, 1 [emitted] styles, app chunk {0} index.js (styles) 117 kb [rendered] ..... webpack: bundle valid.
what i'm expecting:
[14:43:43] finished 'dev' after 66 ms hash: 638bdaa3201a4220c58e version: webpack 1.9.5 time: 7315ms asset size chunks chunk names c91905265455192ab6ea13d95c9edc63.woff 42.6 kb [emitted] b09bad3c727751c808f224df00c208f8.woff 99.6 kb [emitted] index.js 4.83 mb 0, 1 [emitted] styles, app chunk {0} index.js (styles) 117 kb [rendered] ... webpack: bundle valid. [webpack-dev-server] started: browse http://localhost:8002/webpack-dev-server/
alan
try configuring devwebpackconfig
use 'done' plugin.
var compiler = webpack(devwebpackconfig); compiler.plugin('done', function() { console.log("started: browse http://localhost:8002/webpack-dev-server/") }); var server = new webpackdevserver(compiler); server.listen(options.devserverport || 8080, 'localhost', function(err) { if (err) { console.error('[webpack-dev-server] failed start:', err); } });
Comments
Post a Comment