Home >Web Front-end >JS Tutorial >Graphical explanation of vue.js project packaging and launch
This article mainly shares a graphic tutorial for vue.js project packaging and online. It has a good reference value and I hope it will be helpful to everyone. Let’s follow the editor to take a look, I hope it can help everyone.
Recently I have been insisting on writing a small vue.js development project every month. After the final development was completed, I thought of a question I answered to others a long time ago: How to launch a vue project online. At that time, there were all kinds of strange answers. I I'm thinking, are all these people bloated? Vue officials have said that this framework only does the view layer, so it does not copy the developed things directly to the server, and it needs to be packaged as static files for uploading. Server's. Here I will briefly list the process:
First you need to modify the configuration file before packaging. Many people have encountered problems such as running blank after packaging. These problems are mainly path problems, so it is necessary to Modify the options in the index.js configuration file under config:
The first thing to modify in the above picture is the path of the static file. After packaging, the static file will be in the current location. directory, so change it to ./
The second is to set the environment to the production environment
After modification, open cmd and run the following command to package:
Pay attention to the tip below, which tells you that this packaged file needs to be placed on the server before it can be opened. It cannot be opened directly with a browser. The packaged file structure is as follows:
At this time we need to use the server to access index.html. Many people may encounter some problems here. For example, you may use proxytable during development to solve cross-domain problems. There will be no data here. You need to solve this problem by yourself through the server. Proxytable is here It is just a cross-domain solution developed for the convenience of everyone.
Related recommendations:
Detailed explanation of batch downloading and packaging of files in Vue
Packaging tool parcel zero-configuration vue development scaffolding
Example details the correct way to handle the blank display after vue is packaged
The above is the detailed content of Graphical explanation of vue.js project packaging and launch. For more information, please follow other related articles on the PHP Chinese website!