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.

mix.copy does not allow for the glob params.

See original GitHub issue

laravel.mix.js

mix.copy('src/images/*{.png,.jpg}', 'dist/images');

Let’s say I have 2 files:

/src/images/example.png
/src/images/example.jpg

when I run the npm run webpack it copies whole images dir into dist:

/dist/images/src/images/example.png
/dist/images/src/images/example.jpg

and should be:

/dist/images/example.png
/dist/images/example.jpg

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ianhkcommented, Jan 24, 2017

I’m not sure about this fix - it means you can’t copy a tree without it being flattened.

My solution is to use the ‘context’ copy-webpack-plugin option. Context allows you to specify the root that the copy is relative to - rather than implying it all from the ‘from’ arg.

Something like:

mix.copy2 = function (from, to, root) {
    var options = {
        from: from,
        to: Mix.Paths.root(to)
    };
    if (root) {
        options.context = root;
    }
    Mix.copy = (Mix.copy || []).concat(options);
};
1reaction
JeffreyWaycommented, Jan 23, 2017

This is fixed now in #135.

Read more comments on GitHub >

github_iconTop Results From Across the Web

mix.sass does not allow glob params · Issue #241 - GitHub
mix.sass does not allow glob params #241 ... when I run the npm run dev it compile the scss into css and "copies"...
Read more >
How to copy multiple files in one layer using a Dockerfile?
If you want to copy multiple directories (not their contents) under a destination directory in a single command, you'll need to set up...
Read more >
Glob | Laravel Mix Extension
Laravel mix extension that add support for glob. It wrap nicely around laravel mix. Add the glob feature, with some cool features.
Read more >
Compiling Assets (Mix) - The PHP Framework For Web Artisans
Mix provides a useful webpackConfig method that allows you to merge any short Webpack configuration overrides. This is particularly appealing, as it doesn't...
Read more >
Minimal APIs quick reference - Microsoft Learn
Provides an overview of minimal APIs in ASP.NET Core.
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