Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to run vue production build locally?

I created a dist folder using npm run build command in my vue project. I put the dist folder at C:\xampp\htdocs\ and then I started the apache server to test the app locally. whenever I type the http://localhost/dist/index.html in my browser, there is only a blank white page. so, is it possible to run production build locally?

like image 873
max256 Avatar asked Nov 01 '25 06:11

max256


1 Answers

You should probably have something like this in your package.json

"scripts": {
  "preview": "vite preview",
},

supposing you're using Vue3.

Otherwise, serve is a nice alternative to preview an SPA, no need for a XAMPP server. You can install that globally so that you have it on your whole computer.

If you don't have Vite (like in a Vue2 project) or if you want to quickly preview a static app, the command to run is like this

serve dist

PS: you may also need to get admin rights if you're in Windows.

like image 161
kissu Avatar answered Nov 02 '25 21:11

kissu