search

Home  >  Q&A  >  body text

Is it possible to run a vue production build locally?

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粉731977554P粉731977554323 days ago436

reply all(1)I'll reply

  • P粉165522886

    P粉1655228862024-01-17 09:21:40

    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.

    reply
    0
  • Cancelreply