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 method of using goaccess to analyze nginx logs

Recently I want to use goaccess to analyze nginx ...

Causes and solutions for cross-domain issues in Ajax requests

Table of contents 1. How is cross-domain formed? ...

Detailed explanation of rpm installation in mysql

View installation and uninstallation # View rpm -...

How to query and update the same table in MySQL database at the same time

In ordinary projects, I often encounter this prob...

Details of watch monitoring properties in Vue

Table of contents 1.watch monitors changes in gen...

Commonly used HTML format tags_Powernode Java Academy

1. Title HTML defines six <h> tags: <h1&...

Vue two-choice tab bar switching new approach

Problem Description When we are working on a proj...

Implementation of sharing data between Docker Volume containers

What is volume? Volume means capacity in English,...

How to implement import and export mysql database commands under linux

1. Export the database using the mysqldump comman...

Solve the problem of docker pull being reset

This article introduces how to solve the problem ...

Implementation of nginx flow control and access control

nginx traffic control Rate-limiting is a very use...

Solution to 700% CPU usage of Linux process that cannot be killed

Table of contents 1. Problem Discovery 2. View de...

Detailed explanation of how to use the canvas operation plugin fabric.js

Fabric.js is a very useful canvas operation plug-...