Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move files via Webpack

I'm looking for webpack plugin or other solution to move files from one folder to another on afterEmit phase.

There are several plugins that doesn't fit in my case.

  • https://github.com/kevlened/copy-webpack-plugin Can copy but not actually move. Source files should be removed.

  • https://github.com/gregnb/filemanager-webpack-plugin Can't move files via wildcard. It uses node-mv package under the hood. 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. It means that moved files can't be served by webpack.

Is there are any other ready to go solutions?

like image 260
Igor Pchelko Avatar asked Oct 19 '25 22:10

Igor Pchelko


1 Answers

You can try building your own piece of code that does exactly what you need, using webpack compiler hooks. 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.

like image 58
Alex C Avatar answered Oct 22 '25 14:10

Alex C



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!