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

Detailed explanation of Vue form binding and components

Table of contents 1. What is two-way data binding...

MYSQL updatexml() function error injection analysis

First, understand the updatexml() function UPDATE...

A brief discussion on VUE uni-app conditional coding and page layout

Table of contents Conditional compilation Page La...

MySQL 5.7.17 installation graphic tutorial (windows)

I recently started learning database, and I feel ...

Vue.js style layout Flutter business development common skills

Correspondence between flutter and css in shadow ...

About installing python3.8 image in docker

Docker Hub official website 1. Search for Python ...

Solution to elementui's el-popover style modification not taking effect

When using element-ui, there is a commonly used c...

How to display the border when td is empty

Previously, I summarized how to use CSS to achieve...

Summary of MySQL's commonly used database and table sharding solutions

Table of contents 1. Database bottleneck 2. Sub-l...

Use native js to simulate the scrolling effect of live bullet screen

Table of contents 1. Basic principles 2. Specific...

The solution record of Vue failing to obtain the element for the first time

Preface The solution to the problem of not being ...

Detailed process of upgrading gcc (version 10.2.0) under CentOS7 environment

Table of contents Short Introduction 1. Check the...

Summary of MySQL commonly used type conversion functions (recommended)

1. Concat function. Commonly used connection stri...