Home  >  Article  >  Web Front-end  >  What are the problems that may arise after packaging the vuejs project?

What are the problems that may arise after packaging the vuejs project?

php中世界最好的语言
php中世界最好的语言Original
2018-04-08 15:51:451812browse

This time I will bring you what problems may arise after vuejs project packaging, what are the precautions for vuejs project packaging, the following is a practical case, let's take a look.

1: Using CDN resources

When we package, we will package.json, dependenciesPlugins are packaged in objects. 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 to This way:

1: Open webpack.base.conf.js

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

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

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

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

Believe it After reading the case in this article, you have mastered the method. For more exciting information, please pay attention to other related articles on the PHP Chinese website!

Recommended reading:

How to submit data in JSON format to the server

How to use the WeChat applet block

The above is the detailed content of What are the problems that may arise after packaging the vuejs project?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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