Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
3 contributors

Users who have contributed to this file

@JeffreyWay @jeffturcotte @MichaelDeBoey
25 lines (18 sloc) 885 Bytes

Event Hooks

mix.then(function() {});

It's possible that you may need to listen for each time webpack has finished compiling. Perhaps you want to manually apply some bit of logic that is appropriate for your application. If so, you may use the mix.then() method to register any callback function. Here's an example:

mix.js('resources/assets/js/app.js', 'public/js').then(() => {
    console.log('webpack has finished building!');
});

The callback function will be passed a webpack Stats object allowing for inspection of the performed compilation:

mix.js('resources/assets/js/app.js', 'public/js').then(stats => {
    // array of all asset paths output by webpack
    console.log(Object.keys(stats.compilation.assets));
});

Official documentation for the Stats object can be found here: https://github.com/webpack/docs/wiki/node.js-api#stats

You can’t perform that action at this time.