Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

webpack

vuejs2

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.

like image 205
Cyril N. Avatar asked Dec 08 '22 15:12

Cyril N.


1 Answers

If you are using vue-cli, any file in the 'public' folder will be copied to your 'dist' folder.

See https://cli.vuejs.org/guide/html-and-static-assets.html#relative-path-imports

like image 79
Lambert Avatar answered Dec 10 '22 10:12

Lambert