Is it possible to run a vue production build locally?
P粉731977554
P粉731977554 2024-01-16 11:26:54
0
1
430

I created a dist folder in the vue project using the npm run build command. I placed the dist folder in C:xampphtdocs and then started the apache server to test the application locally. Whenever I type http://localhost/dist/index.html into my browser, there is just a blank white page. So, is it possible to run the production build locally?

P粉731977554
P粉731977554

reply all(1)
P粉165522886

You should have something similar in your package.json

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

Assume you are using Vue3.

Also, serve is a good alternative for previewing SPA, without the need for a XAMPP server. You can install it globally so that it is installed on your entire computer.

If you don’t have Vite (such as in a Vue2 project) or you want to quickly preview a static application, the command to run is like this

serve dist

PS: If you are using Windows, you may also need administrator rights.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template