diff --git a/public/index.html b/public/index.html index fa2be91..fb9e5d7 100644 --- a/public/index.html +++ b/public/index.html @@ -6,11 +6,22 @@ <%= webpackConfig.name %> + + + <% for(var css of htmlWebpackPlugin.options.cdn.css) { %> + + <% } %> + + + <% for(var js of htmlWebpackPlugin.options.cdn.js) { %> + + <% } %> +
diff --git a/src/store/index.js b/src/store/index.js index 6be466a..536edb3 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,12 +1,9 @@ -import Vue from 'vue' import Vuex from 'vuex' import getters from './getters' import app from './modules/app' import settings from './modules/settings' import user from './modules/user' -Vue.use(Vuex) - const store = new Vuex.Store({ modules: { app, diff --git a/vue.config.js b/vue.config.js index be1b518..7b95c7d 100644 --- a/vue.config.js +++ b/vue.config.js @@ -51,9 +51,30 @@ module.exports = { alias: { '@': resolve('src') } + }, + externals: { + vue: 'Vue', + 'element-ui': 'ELEMENT' } }, chainWebpack(config) { + const cdn = { + css: [ + // element-ui css + 'https://unpkg.com/element-ui/lib/theme-chalk/index.css' + ], + js: [ + // vue must at first! + 'https://unpkg.com/vue/dist/vue.js', + // element-ui js + 'https://unpkg.com/element-ui/lib/index.js' + ] + } + config.plugin('html') + .tap(args => { + args[0].cdn = cdn + return args + }) config.plugins.delete('preload') // TODO: need test config.plugins.delete('prefetch') // TODO: need test