Files
w4rpservices/node_modules/laravel-mix/src/webpackPlugins/MockEntryPlugin.js
2018-10-27 03:51:47 -05:00

30 lines
842 B
JavaScript
Vendored

class MockEntryPlugin {
/**
* Handle the deletion of the temporary mix.js
* output file that was generated by webpack.
*
* This file is created when the user hasn't
* requested any JavaScript compilation, but
* webpack still requires an entry.
*
* @param {Object} compiler
*/
apply(compiler) {
compiler.plugin('done', stats => {
let temporaryOutputFile = stats
.toJson()
.assets.find(asset => asset.name === 'mix.js');
if (temporaryOutputFile) {
delete stats.compilation.assets[temporaryOutputFile.name];
File.find(
path.resolve(Config.publicPath, temporaryOutputFile.name)
).delete();
}
});
}
}
module.exports = MockEntryPlugin;