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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With