copy-webpack-plugin: Won't find files when there are round brackets () in the path
Plugin can’t find files when there are round brackets in the path: C:\Program Files (x86)\Jenkins\workspace\ProjectName\STG\src\web
More details: Plugin version: 4.5.1 Config:
new CopyWebpackPlugin([
{
from: '../config_app/web.config',
},
],
{debug: 'debug'}
)
If project is located in c:\temp\test (x86)\
folder, nothing is copied.
Logs:
95% emitti 95% emitting CopyPlugin[copy-webpack-plugin] starting emit [copy-webpack-plugin] processing from: ‘…/config_app/web.config’ to: ‘’ [copy-webpack-plugin] determined ‘’ is a ‘dir’ [copy-webpack-plugin] determined ‘…/config_app/web.config’ to be read from ‘c:
temp\test (x86)\config_app\web.config’ [copy-webpack-plugin] begin globbing 'c:/temp\test (x86)\config_app\web.config ’ with a context of ‘c:\temp\test (x86)\config_app’ [copy-webpack-plugin] finishing emit 112ms emitting 98% after 98% after emitting CopyPlugin[copy-webpack-plugin] starting after-em it [copy-webpack-plugin] adding c:\temp\test (x86)\config_app\web.config to change tracking [copy-webpack-plugin] finishing after-emit
If I rename folder to c:\temp\test\
everything is ok.
Logs:
95% emitti 95% emitting CopyPlugin[copy-webpack-plugin] starting emit [copy-webpack-plugin] processing from: ‘…/config_app/web.config’ to: ‘’ [copy-webpack-plugin] determined ‘’ is a ‘dir’ [copy-webpack-plugin] determined ‘…/config_app/web.config’ to be read from ‘c:
temp\test\config_app\web.config’ [copy-webpack-plugin] begin globbing ‘c:/temp\test\config_app\web.config’ with a context of ‘c:\temp\test\config_app’ [copy-webpack-plugin] found c:/temp/test/config_app/web.config [copy-webpack-plugin] determined that ‘c:/temp/test/config_app/web.config’ shoul d write to ‘web.config’ [copy-webpack-plugin] reading c:\temp\test\config_app\web.config to write to ass ets [copy-webpack-plugin] added c1d3d3f388cb75b70467b9c4ac56a90b to written tracking for ‘c:\temp\test\config_app\web.config’ [copy-webpack-plugin] writing ‘web.config’ to compilation assets from ‘c:\temp\t est\config_app\web.config’ [copy-webpack-plugin] finishing emit 110ms emitting 98% after 98% after emitting CopyPlugin[copy-webpack-plugin] starting after-em it [copy-webpack-plugin] adding c:\temp\test\config_app\web.config to change tracki ng [copy-webpack-plugin] finishing after-emit
Is this a bug or I’m doing something wrong?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 7
- Comments: 25 (15 by maintainers)
This issue can be still reproduced if the root folder consists round brackets in its name. For example: d:\Github\Reproduce-round-bracket-bug-in-copy-webpack-plugin\with (round brackets) - OK d:\with (round brackets) - NOT OK
@evilebottnawi yes.
you can verify that by the following steps:
clone the reproduct repo and
npm install
uninstall copy-webpack-plugin 4.5.1 by
npm uninstall --save-dev copy-webpack-plugin
install the latest version from github repo by:
@igoralemasow you can also verify this in your production repo.
@evilebottnawi maybe it’s time for a new release? 😃 The latest version 4.5.1 was released on Mar 9 so it doesn’t contain my fix.
Got it. I’ll check this issue this weekend.
Hi guys, sorry for the late reply.
I checked this issue today and seems it is a bug in node-glob.
See same issue here: https://github.com/isaacs/node-glob/issues/290
I have created a PR for it https://github.com/isaacs/node-glob/pull/373
Fixed in master, release will be soon, if you encounter a problem after updating to
6.0.0
feel free to open a new issue with reproducible test repo, thanks for the issueAny update on a fix for this? We have the same problem on our build server that is installed at C:\Program Files (x86)\Jenkins.
I met the same issue and checked it today.
I found the reason why this plug can not copy the files that has “(x86)” in the directory.
In the source “utils/normalize.js”,
const absoluteContext = path .resolve(context) **.replace(/[\*|\?|\!|\(|\)|\[|\]|\{|\}]/g, (substring) =>
[${substring}]);**
With this part, the file path changes like below example.
C:\\Program Files (x86)\\Jenkins\\ --> C:\\Program Files [(]x86[)]\\Jenkins\\
It causes the empty file list in the code “processPattern.js”.
return globby(pattern.glob, globOptions).then((paths) => Promise.all( paths.map((from) => limit(() => {