From 5db7fddc8a3e084c137fe5aa9592e6f121fcf935 Mon Sep 17 00:00:00 2001 From: Victor Kolb Date: Thu, 22 Nov 2018 23:33:38 +0300 Subject: [PATCH] docs: update example for webpack 4.x usage (#5) --- readme.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index f4f5ceb..92eabcd 100644 --- a/readme.md +++ b/readme.md @@ -33,9 +33,11 @@ const formatMessages = require('webpack-format-messages'); const compiler = webpack(/* config */); -compiler.plugin('invalid', () => console.log('Compiling...')); +compiler.hooks.invalid.tap('invalid', function() { + console.log('Compiling...'); +}); -compiler.plugin('done', stats => { +compiler.hooks.done.tap('done', (stats) => { const messages = formatMessages(stats); if (!messages.errors.length && !messages.warnings.length) { @@ -51,7 +53,7 @@ compiler.plugin('done', stats => { if (messages.warnings.length) { console.log('Compiled with warnings.'); messages.warnings.forEach(w => console.log(w)); - } + } }); ```