When using path like assets/ * * / * to copy a number of files in nested folders, an exception is occured:
A global exception occured: { [Error: EINVAL: invalid argument, read] errno: -4071, code: 'EINVAL', syscall: 'read' }
A number of messages with exception match total number of nested folders, so seems like folders are causing it.
But files and folders are still copied successfully, if to handle global exceptions manually.
Replacing path with assets/ * * / * . * fixes issue. But probably this workaround would't work for files without extension.
+1 this just bit me too.
I have a similar issue? Don't know what went wrong.
My file structure:
src
assets
fonts
img
webpack.config.js
My plugin:
{from: 'src/assets/**/*', to: 'assets'}
With this Webpack output path:
output: {
path: path.join(__dirname, 'public')
}
Results in:
public
assets
src
assets
fonts
But, if I use this plugin:
{from: 'src/assets/fonts', to: 'assets/fonts'}
I get the desired output:
public
assets
fonts
Not sure why this has closed, this just happened to me too on webpack4.
When using a glob pattern in the from path: path/**/* it copys the dir structure over to theto path.
It appears that just stating the directory as @MatthewKosloski has done, it will glob the files within anyway.
@joepagan Can you create minimum reproducible test repo?
@evilebottnawi Of course!
This maybe because it's on webpack-dev-server? The others didn't say. I have seen the large issue where some users want the files to exist when running dev server, though I am happy for these images to be in the memory.
Here is the repo for you:
https://github.com/joepagan/webpack-copywebpackplugin-glob-issue
just clone, yarn; yarn start
Visit:
http://localhost:8080/webpack-dev-server

Now comment out the glob rules in webpack.common.js lines 94-97, and, uncomment 98-101
The paths are then as expected:

Most helpful comment
I have a similar issue? Don't know what went wrong.
My file structure:
My plugin:
With this Webpack output path:
Results in:
But, if I use this plugin:
I get the desired output: