You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
856 B
30 lines
856 B
|
|
let mix = require('laravel-mix');
|
|
let ManifestPlugin = require('laravel-mix/src/webpackPlugins/ManifestPlugin');
|
|
let merge = require('lodash').merge;
|
|
|
|
mix.extend('mergeManifest', (config) => {
|
|
config.plugins.forEach((plugin, index) => {
|
|
if (plugin instanceof ManifestPlugin) {
|
|
config.plugins.splice(index, 1);
|
|
}
|
|
});
|
|
|
|
config.plugins.push(new class {
|
|
apply(compiler) {
|
|
|
|
compiler.hooks.emit.tapAsync('ManifestPlugin', (curCompiler, callback) => {
|
|
let stats = curCompiler.getStats().toJson();
|
|
|
|
try {
|
|
Mix.manifest.manifest = merge(Mix.manifest.read(), Mix.manifest.manifest);
|
|
} catch (e) {
|
|
|
|
}
|
|
|
|
Mix.manifest.transform(stats).refresh();
|
|
callback();
|
|
});
|
|
}
|
|
})
|
|
});
|
|
|