Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to package vuejs projects

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces how to package the vuejs project, which is very detailed and has certain reference value. Friends who are interested must finish it!

Vuejs project packaging methods: 1, open the config directory under the "index.js" file, modify the build under the assetsPublicPath and productionSourceMap options; 2, open the cmd window, the implementation of the "npm run build" command.

The operating environment of this tutorial: windows7 system, vue2.9.6 version, DELL G3 computer.

To package a vuejs project:

First of all, you need to modify the configuration file before packaging. Many people encounter problems such as running blank after packaging. These problems are mainly path problems, so you need to modify the options in the index.js configuration file under config:

The first thing to modify in the above figure is the path of the static file. After packaging, the static file is in the current directory, so it is changed to. /; the second is that the environment is set to the production environment.

After modification, open cmd and run the following command to package:

Pay attention to the following tip, which tells you that the packaged file needs to be placed on the server before it can be opened, and cannot be opened directly using the browser. The packaged file structure is as follows:

At this point, we need to use the server way to access index.html. Many people here may also encounter some problems. For example, if you use proxytable to solve cross-domain problems during development, there will be no data here. You need to solve this problem by yourself through the server. Proxytable is only here to facilitate the development of cross-domain solutions.

The above is all the contents of the article "how to package the vuejs Project". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report