减少打包组件vue.config.js——Webpack的externals的使用

文章转自:https://www.cnblogs.com/xbzhu/p/11815197.html

减少打包组件vue.config.js——Webpack的externals的使用

vue.config.js

复制代码

module.exports = {
    configureWebpack:{
      externals: {
         vue: 'Vue',
         'vue-router':'VueRouter',
         axios: 'axios'
      }
    }
}

复制代码


在index.html文件中引入CDN

复制代码



  
    
    
    
    
    
    
    
    
    
    
    
    
  
  
    
    



    

复制代码

在index.js文件中删除导入的elementui

复制代码

import Vue from 'vue'
import App from './App.vue'
import router from './router'
//import 'element-ui/lib/theme-chalk/index.css'
//import './plugins/element.js'
import './assets/global.css'
Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')

复制代码

你可能感兴趣的:(webpack)