webpackvuejs2

How to copy file to root "dist/" folder with VueJS?


I need to copy some files to the dist folder when running npm run build on a VueJS instance, but I don't know how to do it.

The file would be things like sitemap.xml, robots.txt and some other needed configuration files.

I can eventually create a new folder, either under static/ or anywhere else, and say "copy these files in the /dist/ folder once created".

Is it possible?

Update: I'm using Webpack to generate the dist folder.


Solution

  • I don't think Vue make this problem special.

    You can try this copy plugin for webpack

    https://github.com/webpack-contrib/copy-webpack-plugin

    It can copy files from anywhere to anywhere