Which command do I use to generate the build of a Vue app? Which command do I use to generate the build of a Vue app? vue.js vue.js

Which command do I use to generate the build of a Vue app?


I think you've created your project like this:

vue init webpack myproject

Well, now you can run

npm run build

Copy index.html and /dist/ folder into your website root directory. Done.


If you've created your project using:

vue init webpack myproject

You'd need to set your NODE_ENV to production and run, because the project has web pack configured for both development and production:

NODE_ENV=production npm run build

Copy dist/ directory into your website root directory.

If you're deploying with Docker, you'd need an express server, serving the dist/ directory.

Dockerfile

FROM node:carbonRUN mkdir -p /usr/src/appWORKDIR /usr/src/appADD . /usr/src/appRUN npm installENV NODE_ENV=productionRUN npm run build# Remove unused directoriesRUN rm -rf ./srcRUN rm -rf ./build# Port to exposeEXPOSE 8080CMD [ "npm", "start" ]


in your terminal

npm run build

and you host the dist folder. for more see this video