VUEJS Production Environment Deployment

Source: Internet
Author: User

Vuejs is the client language, so the deployment is not required based on NODEJS or other server operating environment, just like other static site way to publish it, the following describes the Vuejs specific release of the process and need to pay attention to the point.

Let's take a look at the final file directory generated by Vuejs:

The specific steps are as follows:

1.vue Project root directory/config/index.js change the resource generation path:

Assetspublicpath: "/project name/" changed to Assetspublicpath: "/"

Fix the problem: index.html resource access is not available, the resource is more than the path of the project name.

2. Use the npm Run build command to build the site , the site is the root directory of the dist file;

3. Solve the problem of 404 when the site refreshes;

To this step when the site has been able to access the normal, can not F5 refresh, refresh time return 404, carefully observe the command will find that the path has become our Vue route inside the "virtual path" is set, so will certainly 404, this time needs to be set on the running server, The access to the path is index.html, this time the site on the spending refresh, such as if I use Nginx proxy, configuration:

Location/{  try_files $uri $uri//index.html;}

  

More server configurations click: https://github.com/vuejs/vue-router/blob/dev/docs/zh-cn/essentials/history-mode.md

VUEJS Production Environment Deployment

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.