npm list --depth=0)node -v): 7.8.0npm -v): 5.0.4Previously (pre 1.0.0) when utilizing multiple mix.js files the output to mix-manifest.json would be merged and would contain references to files from both mix.js configs. Now mix-manifest.json is overwritten each time mix is run.
webpack.mix.js to webpack-two.mix.jswebpack-two.mix.js and change both instances of app.js to app2.js (create a dummy file with that name where appropriate)npm run dev followed by NODE_ENV=development webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js --env.mixfile=webpack-two.mix.jsExpected behavior:
mix-manifest.json should contain references to both app.js and app2.js
What happens instead:
mix-manifest.json contains references to either app.js OR app2.js, but not both (whatever was run last overwrites the whole file)
The reason I have 2 separate mix.js configs in the first place is because I have an "external" JS file that is part of the project and is included by 3rd party sites, this file shares some (but not all) dependencies with the main app.js file.
If I process both files in one mix.js config then when .extract() is called it extracts vue and axios (dependencies shared by both files) to vendor.js, while I only want this to happen for app.js and on my external JS file I want all dependencies in the file and not extracted.
If there's a way to do this through 1 mix.js config I'm all ears.
Now you may wonder why mix-manifest.json matters for my use case, I also have a local test page where the external JS file is pulled in for demo purposes and since I use .version() with both it makes sense to have it work out of the box rather than hardcoding it.
Even if I were to hardcode it though I would have to make sure to always run the main mix.js config after the external config or risk a inaccurate mix-manifest.json breaking the main site.
Figured out a temporary(?) solution. I added .version() cross-referencing outputs of both configs. So now mix-manifest.json contains all files no matter what is run.
Still would be nice if this worked out of the box.
mix.js('resources/assets/js/app.js', 'public/js/app.js')
.sass('resources/assets/sass/app.scss', 'public/css')
.version([
'public/js/app2.js',
'public/css/app2.css'
]);
@JeffreyWay @pix2D this is confirmed. it seems during the rewrite of Mix the relevant code didn't make it.
I have the same issue after upgrading from 0.12.1 to 1.4.2. Works well on lower version.
I encounter this problem too with version 1.4.2.
I use two mix files because my Laravel project handles two different subdomains. Although mix doesn't support it, it can work using the workaround proposed here. The problem described here removes the map for one of the domains when the other one is built.
@pix2D's trick worked for me two in the wait of a fix. But it would be nice to be able to define the desired mix-manifest.json output file for a given webpack config.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
Figured out a temporary(?) solution. I added .version() cross-referencing outputs of both configs. So now mix-manifest.json contains all files no matter what is run.
Still would be nice if this worked out of the box.