Search code examples
javascriptvue.jsproductionvite

How to Build Vue 3 Vite App for production


I created a fresh vue project with the new version which includes vite init.

When I run npm run build a dist/ is created. But when I open dist/index.html inside the dist folder it doesn't show anything. My question is how can I build the app and run it without any command (Building for production). Thanks


Solution

  • You need a server, otherwise assets will fail to be found and you'll get errors and a blank page. Use npm run preview.