[英]Move files via Webpack
I'm looking for webpack plugin or other solution to move
files from one folder to another on afterEmit
phase. 我正在寻找webpack插件或其他解决方案,以便在
afterEmit
阶段move
文件从一个文件夹move
到另一个文件夹。
There are several plugins that doesn't fit in my case. 有几个我不适合的插件。
https://github.com/kevlened/copy-webpack-plugin Can copy
but not actually move
. https://github.com/kevlened/copy-webpack-plugin可以
copy
但不能实际move
。 Source files should be removed. 源文件应被删除。
https://github.com/gregnb/filemanager-webpack-plugin Can't move files via wildcard. https://github.com/gregnb/filemanager-webpack-plugin无法通过通配符移动文件。 It uses
node-mv
package under the hood. 它在
node-mv
使用了node-mv
软件包。 So I can't use following config: 所以我不能使用以下配置:
...
move: [
{ source: './dest/assets/*.map', destination: './dest' },
]
...
Another downside of filemanager-webpack-plugin
is it doesn't update webpack internal assets state. filemanager-webpack-plugin
另一个缺点是它不会更新webpack内部资产状态。 It means that moved files can't be served by webpack. 这意味着webpack无法提供已移动的文件。
Is there are any other ready to go solutions? 还有其他随时可用的解决方案吗?
You can try building your own piece of code that does exactly what you need, using webpack compiler hooks . 您可以尝试使用webpack 编译器hook构建自己的代码,完全满足您的需求。 I know this is not a "ready to go solution" but sometimes searching for plugins takes more time than actually writing your own code, especially if it's a simple task.
我知道这不是“立即可用的解决方案”,但是有时搜索插件要比实际编写自己的代码花费更多的时间,尤其是在这很简单的情况下。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.