KABBOUCHI / laravel-mix-merge-manifest

This extension support multi mix configration without overwriting the mix-manifest.json file
62 stars 6 forks source link

How to extract and merge common vendor? #5

Open u3u opened 5 years ago

u3u commented 5 years ago

Hi, This plugin is great! But there are still some minor problems:

Multiple sites import the same public component, and all sites cannot be updated at once when this component is updated.

This problem was solved by concurrently in this article, but this will cause the bundle to slow down.

Is there a better solution to this?

u3u commented 5 years ago

Is there any way to get them in the same process? Like this:

const mix = require('laravel-mix');

require('laravel-mix-merge-manifest');

mix
  .js('resources/assets/js/front/app.js', 'public/js')
  .less('resources/assets/less/front/app.less', 'public/css')
  .extract()
  .mergeManifest();

mix
  .js('resources/assets/js/admin/app.js', 'public/js')
  .less('resources/assets/less/admin/app.less', 'public/css')
  .extract()
  .mergeManifest();
KABBOUCHI commented 5 years ago

Is there any way to get them in the same process?

Why you don't do it like this?

const mix = require('laravel-mix');

mix
  .js('resources/assets/js/front/app.js', 'public/js')
  .less('resources/assets/less/front/app.less', 'public/css')

mix
  .js('resources/assets/js/admin/app.js', 'public/js/admin.js')
  .less('resources/assets/less/admin/app.less', 'public/css/admin.css')

mix.extract()

The purpose of this package to develop every module/section alone.

How to extract and merge common vendor?

not sure if possible to do that, normally I define package.json for each section/module, every module has its own public path (mix.setPublicPath( '/public/admin'))