Quantcast
Channel: Active questions tagged require - Stack Overflow
Viewing all articles
Browse latest Browse all 166

Vuejs access to file outside of the application

$
0
0

I have several files on my server located at /var/www/files/
My vuejs is in ~/Dev/app
I did : let file = require('/var/www/files/myfile.jpg')
then npm run build my app.
But I have this error 🫣 :

Error: Cannot find module '/var/www/files/myfile.jpg'

I can access my files when they are in ~/Dev/app/public/ tho 😅

To add a bit more clarity : I want my user to download a file from my server to its web browser. I can do that when the file is in the project /public but not when it's somewhere else on the server.


Viewing all articles
Browse latest Browse all 166

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>