admin管理员组文章数量:1417051
I'm trying to use CopyWebpackPlugin to copy some files out of my node_modules folder and into my build folder.
new CopyWebpackPlugin([
{ from: 'node_modules/accounting/**', to: 'vendor/npm/' },
{ from: 'node_modules/angular/**', to: 'vendor/npm/' },
I would expect this to output to my build folder /build/vendor/npm/accounting
and build/vendor/npm/angular
respectively, but instead a node_modules
folder is created - the files are actually outputted to build/vendor/npm/node_modules/accounting
.
How can I prevent the node_modules folder being created and get my expected output?
I'm trying to use CopyWebpackPlugin to copy some files out of my node_modules folder and into my build folder.
new CopyWebpackPlugin([
{ from: 'node_modules/accounting/**', to: 'vendor/npm/' },
{ from: 'node_modules/angular/**', to: 'vendor/npm/' },
I would expect this to output to my build folder /build/vendor/npm/accounting
and build/vendor/npm/angular
respectively, but instead a node_modules
folder is created - the files are actually outputted to build/vendor/npm/node_modules/accounting
.
How can I prevent the node_modules folder being created and get my expected output?
Share Improve this question edited Oct 2, 2018 at 15:12 CD-jS asked Oct 2, 2018 at 14:11 CD-jSCD-jS 1,1191 gold badge15 silver badges33 bronze badges2 Answers
Reset to default 4For future reference, the actual correct answer is that I needed context -
{ from: 'accounting/**', to: 'vendor/npm', context: 'node_modules' }
Include a leading /
to use the absolute output path
new CopyWebpackPlugin([
{ from: 'node_modules/accounting/**', to: '/build/vendor/npm/accounting' },
{ from: 'node_modules/angular/**', to: '/build/vendor/npm/angular' },
],
Because you're using a glob in your from
path, the to
path is relative to the resolved from
paths. Github docs.
本文标签:
版权声明:本文标题:javascript - Using CopyWebpackPlugin how can I copy files out of node_modules into a folder without it creating a node_modules f 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745261840a2650389.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论