diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 4dcd81e40459ab121777758265f5d1b3be3e34b9..34c7ece709141f3089daa34c9ed25dbbbfab981e 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -13,6 +13,9 @@ const portfinder = require('portfinder') const HOST = process.env.HOST const PORT = process.env.PORT && Number(process.env.PORT) +//cdn 配置 +let externalConfig = [] + const devWebpackConfig = merge(baseWebpackConfig, { module: { rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) @@ -55,7 +58,8 @@ const devWebpackConfig = merge(baseWebpackConfig, { new HtmlWebpackPlugin({ filename: 'index.html', template: 'index.html', - inject: true + inject: true, + cdnConfig: externalConfig, // cdn配置 }), // copy custom myblog_static assets new CopyWebpackPlugin([ diff --git a/src/main.js b/src/main.js index fe62c947e6e47b0aeab6293a790635e582b3a886..971194c6e4121b3f40fb05e7fae3734af4f88bd6 100644 --- a/src/main.js +++ b/src/main.js @@ -1,17 +1,19 @@ // The Vue build version to load with the `import` command // (runtime-only or standalone) has been set in webpack.base.conf with an alias. -// import Vue from 'vue' -// import VueRouter from 'vue-router' -// import axios from 'axios' -// import hljs from 'highlight.js' +//vue cdn +import Vue from 'vue' +import VueRouter from 'vue-router' +import axios from 'axios' +import hljs from 'highlight.js' +import importElementComponents from './importElement' +import importEchartsComponents from './importEchartsComponents' +// 样式cnd +import 'github-markdown-css/github-markdown.css' +import 'nprogress/nprogress.css' +// 无需cdn import useRouter from './router' import cookies from 'vue-cookies' import App from './App' -// import importElementComponents from './importElement' -// import importEchartsComponents from './importEchartsComponents' -// 样式 -// import 'github-markdown-css/github-markdown.css' -// import 'nprogress/nprogress.css' import 'highlight.js/styles/github.css' import * as echarts from 'echarts/core' @@ -23,12 +25,6 @@ if (env === 'production') { // 路由 const router = useRouter(Vue, VueRouter) - // // 按需引入elementui - // importElementComponents(Vue) - // - // // 按需引入echarts - // importEchartsComponents(Vue) - Vue.config.productionTip = false Vue.use(cookies) Vue.use(hljs) diff --git a/src/router/index.js b/src/router/index.js index dada4c1c60f6e984ab3d896a666c69149dcf8c34..db0edfea5e7f80a6031eb0dda36574a6624fd2a7 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -9,7 +9,6 @@ const Bilicom = () => import('@/components/Bilicom') const Mavoneditor = () => import('@/components/Mavoneditor') const GrilShow = () => import('@/components/GrilShow') const Csslearn = () => import('@/components/Csslearn') - const defaultRoutes = [ { path: '/', diff --git a/src/store/index.js b/src/store/index.js index b1f7a9c9943778a7d89558993e2c7bf92ae9c71f..56a2d66f0f8e2d6dea16b7447702214855466b07 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,5 +1,5 @@ -// import Vue from 'vue' -// import Vuex from 'vuex' +import Vue from 'vue' +import Vuex from 'vuex' import persistedstate from 'vuex-persistedstate'