Vue.js: Quickly build projects with VUE-CLI

Source: Internet
Author: User

What is VUE-CLI?

VUE-CLI is a vue.js scaffold for automatic generation of vue.js template works.

How to use VUE-CLI?

Before installing VUE-CLI, you need to install Vue and Webpack, do not know how to install can see my previous article "Vue + Webpack Implementation of the SPA application Document"
Installing VUE-CLI

NPM install-g VUE-CLI//Global installation VUE-CLI
Vue init webpack projectName//Generate the project name ProjectName template, here the project name ProjectName with your own writing
CD ProjectName
NPM Install//Initialize installation dependencies

So the sub-project is installed. The following directory for the generated project is like this


And then execute

NPM Run Dev

When you open http://localhost:8080 in your browser, you can see the Welcome page.


But this can only be run locally, how to access it on our own server? You need to do this

NPM Run Build

Will generate a static file, in the root directory of the Dist, there is a index.html, which is the server access to the path specified here to access our own projects. But I found a problem is to generate index.html referenced in the CSS and JS reference path is not correct, this time you need to modify the configuration.

Enter Config/index.js

The reference path for the original configuration is


I change myself to


This will enable normal access.

Vue.js: Quickly build projects with VUE-CLI

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.