简体   繁体   English

通过Webpack移动文件

[英]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. 有几个我不适合的插件。

...
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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM