Hello, is there a way to ignore the files that does not exist instead of throwing errors?
As far as I remember, webpack 1.x version of copy-webpack-plugin ignored non-existing files, didn't it? Anyways, having a flag for such a behavior would be great.
@hellivan i'm using 2.x so i'm not aware of that. Indeed, a flag to not throw errors and stop the bundling would be really nice!
@PlayMa256 If you use the context property you don't get any error if the folder/file doesn't exist.
{ context: path.resolve(__dirname, "a", "b"), from: "**/*", to: "c" }
I don't suppose it's possible to do this when you're not using globs?
{ from: 'a' },
{ from: 'b/c', to: 'c' },
{ from: 'd' }
I'd like to just get a warning when a specific "from" file doesn't exist, not break the build.
I'm looking into this as a workaround for https://github.com/webpack/webpack/issues/5360
@michael-ciniawsky what do you think about this option?
hmm... imho it's simply an {Error} (ENOENT) 馃槢. But if this is common in build chains (CI) to sneak in for some reason we can consider to relax it into a warning. But e.g sole 'misconfiguration' (adding patterns for non-existent files) isn't enough to justify changing the current behavior tbh.
would be nice to have an option like this or just another debug option ignore or silent. we run several apps through the same webpack config and have to include the plugin conditionally now. thanks for all your work on that plugin 馃挭
Im having the same issue as @zanettin , would love the option to convert from error to warning
I don't suppose it's possible to do this when you're not using globs?
@derekdon Under the hood copy-webpack-plugin uses is-glob to detect whether it is a glob expression or not. So you can trick is-glob by constructing a glob expression essentially equivalent to a single file before this issue gets closed:
{
context: path.resolve(__dirname, "a", "b"),
from: "@(c)",
to: "c"
}
If you need copy multiple files, simply write the glob expression for sure.
Most helpful comment
@PlayMa256 If you use the
contextproperty you don't get any error if the folder/file doesn't exist.