question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

--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:

  1. Copy webpack.mix.js to webpack-two.mix.js
  2. Edit webpack-two.mix.js and change both instances of app.js to app2.js (create a dummy file with that name where appropriate)
  3. Run 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.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:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
pix2Dcommented, Jun 29, 2017

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'
    ]);
0reactions
stale[bot]commented, Dec 4, 2018

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

env.mixfile and mix-manifest.json · Issue #946 - GitHub
--env.mixfile and mix-manifest.json #946 ... mix-manifest.json should contain references to both app.js and app2.js. What happens instead:.
Read more >
Versioning with Mix, manifest does not exist. {but.... it does!)
json, so i changed it to what it was asking for 'manifest.json'. So I ran npm run production and... now It says; Unable...
Read more >
Compiling Assets (Mix) - The PHP Framework For Web Artisans
Mix is a configuration layer on top of webpack, so to run your Mix tasks you only need to execute one of the...
Read more >
Versioning | Laravel Mix Documentation
To assist with long-term caching, Laravel Mix provides the mix.version() method to ... Return to mix-manifest.json and you'll notice that, for each change, ......
Read more >
Mix manifest not found on laravel 9 - vite - Stack Overflow
json. Now i get the others errors "Unable to locate Mix file: /css/app.css.". Have any solution? – Efendy ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found