Home > Web Front-end > JS Tutorial > body text

vuejs project packaging optimization

php中世界最好的语言
Release: 2018-06-12 10:40:46
Original
1372 people have browsed it

This time I will bring you vuejs project packaging optimization. What are the precautions for vuejs project packaging optimization? The following is a practical case, let’s take a look.

1: Using CDN resources

When we package, we will package the plug-ins in the dependencies object in package.json. 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 webpack.base.conf.js

module.exports = {
   externals: {
    ‘vue‘: ‘Vue‘,
    ‘axios‘: ‘axios‘,
    ‘vuex‘: ‘Vuex‘,
    ‘vue-router‘: ‘VueRouter‘
 }
}
Copy after login

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

//import Vue from ‘vue‘
//Vue.use(Router)
Copy after login

3: If you use vuex, log out Vue.use(Vuex) in vuex/index.js (named differently)

Vue.use(Vuex)

##Possible problems after packaging

1: Elements surrounded by keep-alive cannot Reason for displaying

: Unknown.

Solution: No need to keep-alive

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

I believe you have mastered the method after reading the case in this article, more Please pay attention to other related articles on the php Chinese website!

Recommended reading:

react to split page code and load on demand

What are the precautions for using Dom with Angular2

The above is the detailed content of vuejs project packaging optimization. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!