SoFunction
Updated on 2025-04-04

The first screen load optimization after the vuejs project is packaged and the problems that arise after the package are packaged.

1: Use CDN resources

When we package, we will package the plug-ins in the dependencies object. We can load some of them using cdn. For example, if we don't want to package vue, axios, vuex, and vue-router into our project, we need this:

1: Open

 = {
   externals: {
    ‘vue‘: ‘Vue‘,
    ‘axios‘: ‘axios‘,
    ‘vuex‘: ‘Vuex‘,
    ‘vue-router‘: ‘VueRouter‘
 }
}

2: Open router/. Log out the following two lines

//import Vue from ‘vue‘
//(Router)

3: If you use vuex, log out of (Vuex) in vuex/ (names are different)

(Vuex)

Problems that may arise after packaging

1: The elements surrounded by keep-alive cannot be displayed

Reason: Not yet known.

Solution: No need to keep-alive

Recommended reading:Vue project uses CDN to optimize first-screen loading problem

Summarize

The above is the first-screen loading optimization after the vuejs project is introduced to you by the editor and the problems that arise after the vuejs project is packaged. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time!