Detailed explanation of Vue project packaging

Detailed explanation of Vue project packaging

1. Related configuration

Case 1 (the tool used is vue-cil)

If the project is created with vue-cli, there is no config folder in the project directory, so we need to create a configuration file ourselves; create a file vue.config.js in the root directory src. Note that the file name must be vue.config.js, and then insert the following code in the file:

 //Packaging configuration file module.exports = {
  assetsDir: 'static',
  parallel: false,
  publicPath: './',
};

The structure is as follows:

Case 2 (the tool used is webpack)

If you are using webpack, modify the webpack configuration directly in the index.js file in config:

 assetsPublicPath: './'

The structure is as follows:

2. Packaging

After the configuration is completed, call up the console and enter the packaging command npm run build to start packaging;

After success, there will be the following prompt;

And the dist folder will be automatically generated in the project directory;

The dist folder is the package we need, and then it can be put on the server for deployment. It should be noted that after packaging, no matter what changes are made in the project, npm run build is required to repackage.

Summarize

This article ends here. I hope it can be helpful to you. I also hope you can pay more attention to more content on 123WORDPRESS.COM!

You may also be interested in:
  • Detailed explanation of different packaging commands for different vue environments
  • Detailed explanation of vue project packaging steps
  • How to use vue-cli to create a project and package it with webpack
  • Configure your own startup command and packaging command method in the Vue project

<<:  Solution to the failure of 6ull to load the Linux driver module

>>:  Detailed explanation of scroll bar scrolling control of DOM elements in HTML

Recommend

Solution for forgetting the root password of MySQL5.7 under Windows 8.1

【background】 I encountered a very embarrassing th...

Three ways to forward linux ssh port

ssh is one of the two command line tools I use mo...

Simple example of adding and removing HTML nodes

<br />Simple example of adding and removing ...

4 flexible Scss compilation output styles

Many people have been told how to compile from th...

JavaScript to achieve progress bar effect

This article example shares the specific code of ...

Simple understanding and examples of MySQL index pushdown (ICP)

Preface Index Condition Pushdown (ICP) is a new f...

Transplanting the mkfs.vfat command in busybox under Linux system

In order to extend the disk life for storing audi...

Example code of vue icon selector

Source: http://www.ruoyi.vip/ import Vue from ...

In-depth explanation of currying of JS functions

Table of contents 1. Supplementary knowledge poin...

Solution to css3 transform transition jitter problem

transform: scale(); Scaling will cause jitter in ...

Solution to Apache cross-domain resource access error

In many cases, large and medium-sized websites wi...