--env.mixfile and mix-manifest.json
See original GitHub issue- Laravel Mix Version: 1.0.7 (
npm list --depth=0
) - Node Version (
node -v
): 7.8.0 - NPM Version (
npm -v
): 5.0.4 - OS: macOS 10.12.5
Description:
Previously (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.
Steps To Reproduce:
- Copy
webpack.mix.js
towebpack-two.mix.js
- Edit
webpack-two.mix.js
and change both instances ofapp.js
toapp2.js
(create a dummy file with that name where appropriate) - Run
npm run dev
followed byNODE_ENV=development webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js --env.mixfile=webpack-two.mix.js
Expected 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.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:5 (1 by maintainers)
Top GitHub Comments
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.
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.