打包时ElementUI使vendor.js文件体量过大优化方法

<h1>
1.在index.html中以CDN的方式引入    
</h1>
<p>
引入的时候注意:要先在引入之前引入VUE否则会报undedined prototype的错误
</p>
<h1>
2.webpack.base.conf.js文件的module.exports={}中加入过滤
externals: {
    'vue': 'Vue',
    'element-ui': 'ELEMENT',
    'element-ui': 'element-ui',
    'axios': 'axios',
    'vue': 'Vue',
    'vue-router': 'VueRouter',
    'axios': 'axios',
    'element-ui': 'ELEMENT',
    'i18n': 'i18n',
 }
</h1>

3.elementUI以CDN方式引入的时候,必须要先以CDN的方式引入VUE,否则会报undefined prototype的错误

原文地址:https://www.cnblogs.com/yanghaifeng/p/9530368.html