提交 556c6921 编写于 作者: yma16's avatar yma16

perf:gzip打包优化-build分支 dev 配置合入master

上级 eec44107
...@@ -13,6 +13,9 @@ const portfinder = require('portfinder') ...@@ -13,6 +13,9 @@ const portfinder = require('portfinder')
const HOST = process.env.HOST const HOST = process.env.HOST
const PORT = process.env.PORT && Number(process.env.PORT) const PORT = process.env.PORT && Number(process.env.PORT)
//cdn 配置
let externalConfig = []
const devWebpackConfig = merge(baseWebpackConfig, { const devWebpackConfig = merge(baseWebpackConfig, {
module: { module: {
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
...@@ -55,7 +58,8 @@ const devWebpackConfig = merge(baseWebpackConfig, { ...@@ -55,7 +58,8 @@ const devWebpackConfig = merge(baseWebpackConfig, {
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
filename: 'index.html', filename: 'index.html',
template: 'index.html', template: 'index.html',
inject: true inject: true,
cdnConfig: externalConfig, // cdn配置
}), }),
// copy custom myblog_static assets // copy custom myblog_static assets
new CopyWebpackPlugin([ new CopyWebpackPlugin([
......
// The Vue build version to load with the `import` command // The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias. // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
// import Vue from 'vue' //vue cdn
// import VueRouter from 'vue-router' import Vue from 'vue'
// import axios from 'axios' import VueRouter from 'vue-router'
// import hljs from 'highlight.js' 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 useRouter from './router'
import cookies from 'vue-cookies' import cookies from 'vue-cookies'
import App from './App' 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 'highlight.js/styles/github.css'
import * as echarts from 'echarts/core' import * as echarts from 'echarts/core'
...@@ -23,12 +25,6 @@ if (env === 'production') { ...@@ -23,12 +25,6 @@ if (env === 'production') {
// 路由 // 路由
const router = useRouter(Vue, VueRouter) const router = useRouter(Vue, VueRouter)
// // 按需引入elementui
// importElementComponents(Vue)
//
// // 按需引入echarts
// importEchartsComponents(Vue)
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.use(cookies) Vue.use(cookies)
Vue.use(hljs) Vue.use(hljs)
......
...@@ -9,7 +9,6 @@ const Bilicom = () => import('@/components/Bilicom') ...@@ -9,7 +9,6 @@ const Bilicom = () => import('@/components/Bilicom')
const Mavoneditor = () => import('@/components/Mavoneditor') const Mavoneditor = () => import('@/components/Mavoneditor')
const GrilShow = () => import('@/components/GrilShow') const GrilShow = () => import('@/components/GrilShow')
const Csslearn = () => import('@/components/Csslearn') const Csslearn = () => import('@/components/Csslearn')
const defaultRoutes = [ const defaultRoutes = [
{ {
path: '/', path: '/',
......
// import Vue from 'vue' import Vue from 'vue'
// import Vuex from 'vuex' import Vuex from 'vuex'
import persistedstate from 'vuex-persistedstate' import persistedstate from 'vuex-persistedstate'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册