Which command do I use to generate the build of a Vue app?
If you run into problems with your path, maybe you need to change the assetPublicPath
in your config/index.js
file to your sub-directory:
http://vuejs-templates.github.io/webpack/backend.html
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:carbon
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ADD . /usr/src/app
RUN npm install
ENV NODE_ENV=production
RUN npm run build
# Remove unused directories
RUN rm -rf ./src
RUN rm -rf ./build
# Port to expose
EXPOSE 8080
CMD [ "npm", "start" ]
in your terminal
npm run build
and you host the dist folder. for more see this video
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.