Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not copy new file in watch mode #252

Closed
k8w opened this issue Apr 12, 2018 · 7 comments · Fixed by #333
Closed

Not copy new file in watch mode #252

k8w opened this issue Apr 12, 2018 · 7 comments · Fixed by #333

Comments

@k8w
Copy link

k8w commented Apr 12, 2018

I use

new CopyWebpackPlugin([
    'res/**/*.*'
])

and

webpack -w --mode=development

When watching, if I create a new file (like res/test.txt), it would not copy to the output path.
I must restart webpack.

@alexander-akait
Copy link
Member

@k8w strange, can you create minimum reproducible test repo?

@k8w
Copy link
Author

k8w commented Apr 13, 2018

@evilebottnawi Here~
https://github.com/k8w/copy-webpack-plugin-issue-252

@imtbl
Copy link

imtbl commented May 8, 2018

Any update on this?

I can confirm the issue (using webpack@4.8.1 and copy-webpack-plugin@4.5.1). It also doesn't work when using webpack-dev-server instead of watch mode.

EDIT: I just read about write-file-webpack-plugin in your readme and will give that a try when using webpack-dev-server.

@alexander-akait
Copy link
Member

alexander-akait commented May 8, 2018

When webpack in watch mode, he use memory-fs to increase perf and you can't see files in file system when you in watch mode, it is expected. I update readme about this in near future. Solution:

  1. https://github.com/webpack/webpack-dev-middleware#writetodisk
  2. write-file-webpack-plugin

@x-yuri
Copy link

x-yuri commented Oct 5, 2018

@evilebottnawi The issue is not about it not writing files to filesystem, but about it not noticing new files.

I've run into it with webpack-dev-server. I believe it has to do with it not adding dependencies when from is a glob, as opposed to dirs, and files.

The workaround is to, e.g., replace 'src/assets/**/*' with {from: 'src/assets', to: 'assets'}.

@alexander-akait
Copy link
Member

@x-yuri please create minimum reproducible test repo

@x-yuri
Copy link

x-yuri commented Oct 5, 2018

@evilebottnawi Doesn't the one from the earlier post work for you? It says:

If I add a 3.txt into res, it would not trigger webpack recompile.(watch mode)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants