From ace3704afc0cfbb395262b057278a4aeff97b838 Mon Sep 17 00:00:00 2001 From: evillt Date: Sat, 11 May 2019 14:08:42 +0800 Subject: [PATCH] fix(poi): print serve message via `afterPlugins` hook --- poi.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/poi.js b/poi.js index 5e1cc03..471f19f 100644 --- a/poi.js +++ b/poi.js @@ -18,15 +18,22 @@ exports.apply = api => { */ delete config.devServer.open - console.log() - console.log('You can now view your app in the browser:') - console.log(`Local: http://${prettyHost}:${colors.bold(port)}`) - console.log() - - /** - * Override poi progress plugin - */ api.hook('createWebpackChain', config => { + config.plugin('print-loading-screen-serve').use({ + apply(compiler) { + compiler.hooks.afterPlugins.tap('print-loading-screen-serve', () => { + console.log() + console.log('You can now view your app in the browser:') + console.log( + `Local: http://${prettyHost}:${colors.bold(port)}` + ) + console.log() + }) + } + }) + /** + * Override poi progress plugin + */ config.plugin('progress').init( (_, [handler]) => new LoadingScreenPlugin({