优化 cdn

Former-commit-id: c8ae44e414
Former-commit-id: 0369fc58b7831e26856b4420515f5474b9b9baa6
Former-commit-id: eb67ae970c2bde2a1548e6391d71993d5101cd3b
Former-commit-id: 794f10cffd1b4231d7845fca06b2846836af81f2 [formerly 77db2f9f48e23fcac300ba7bbb4575017be60fe5]
Former-commit-id: 4bb84b8a7988e24c34fa52cd55854150685dd87b
Former-commit-id: acdc488249ed128515b1535550386798cc073331
Former-commit-id: 97a280dce9b99c586e0abe6becd0691ebc566168
Former-commit-id: 2ac90ba4f392b40691f6d2f829aaa398ed9c11cd
Former-commit-id: cfae347f60ef1e46b3035b374cf175a3b57ab1dc
This commit is contained in:
FairyEver 2019-12-13 11:11:01 +08:00
parent 9712ec1bd5
commit f5c14f23fa
5 changed files with 63 additions and 30 deletions

50
dependencies.js Normal file
View File

@ -0,0 +1,50 @@
module.exports = [
{
name: 'vue',
library: 'Vue',
css: '',
js: 'https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js'
},
{
name: 'vue-router',
library: 'VueRouter',
css: '',
js: 'https://unpkg.com/vue-router@3.0.6/dist/vue-router.js'
},
{
name: 'vuex',
library: 'Vuex',
css: '',
js: 'https://unpkg.com/vuex@3.1.1/dist/vuex.js'
},
{
name: 'axios',
library: 'axios',
css: '',
js: 'https://unpkg.com/axios@0.19.0/dist/axios.min.js'
},
{
name: 'better-scroll',
library: 'BScroll',
css: '',
js: 'https://unpkg.com/better-scroll@1.15.2/dist/bscroll.min.js'
},
{
name: '@d2-projects/d2-crud',
library: 'D2Crud',
css: '',
js: 'https://cdn.d2.pub/packages/@d2-projects/d2-crud@2.0.5/d2-crud.js'
},
{
name: '@d2-projects/vue-table-export',
library: 'VueTableExport',
css: '',
js: 'https://cdn.d2.pub/packages/@d2-projects/vue-table-export@1.0.1/vue-table-export.js'
},
{
name: '@d2-projects/vue-table-import',
library: 'VueTableImport',
css: '',
js: 'https://cdn.d2.pub/packages/@d2-projects/vue-table-import@1.0.0/vue-table-import.js'
}
]

View File

@ -1 +1 @@
975a87cbfa94ae0055fa5dbbf387398b44b8c8f0
aff59b5ca2c032fa2b8d57ed2c330018047d3263

View File

@ -23,11 +23,11 @@
"countup.js": "^2.0.4",
"dayjs": "^1.8.14",
"echarts": "^4.2.1",
"element-ui": "^2.11.1",
"element-ui": "^2.13.0",
"flex.css": "^1.1.7",
"fuse.js": "^3.4.5",
"github-markdown-css": "^3.0.1",
"highlight.js": "^9.15.8",
"highlight.js": "^9.17.1",
"hotkeys-js": "^3.6.11",
"js-cookie": "^2.2.0",
"lodash": "^4.17.11",
@ -41,13 +41,13 @@
"simplemde": "^1.11.2",
"ua-parser-js": "^0.7.20",
"v-charts": "^1.19.0",
"v-contextmenu": "^2.8.0",
"v-contextmenu": "^2.9.0",
"vue": "^2.6.10",
"vue-grid-layout": "^2.3.4",
"vue-i18n": "^8.11.2",
"vue-i18n": "^8.15.1",
"vue-json-tree-view": "^2.1.4",
"vue-router": "^3.0.6",
"vue-splitpane": "^1.0.4",
"vue-splitpane": "^1.0.6",
"vue-ueditor-wrap": "^2.4.1",
"vuex": "^3.1.1"
},

View File

@ -14,11 +14,11 @@ import routes from './routes'
// fix vue-router NavigationDuplicated
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
return VueRouterPush.call(this, location).catch(err => err)
return VueRouterPush.call(this, location)
}
const VueRouterReplace = VueRouter.prototype.replace
VueRouter.prototype.replace = function replace (location) {
return VueRouterReplace.call(this, location).catch(err => err)
return VueRouterReplace.call(this, location)
}
Vue.use(VueRouter)

View File

@ -1,11 +1,9 @@
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = ['js', 'css']
const VueFilenameInjector = require('@d2-projects/vue-filename-injector')
const ThemeColorReplacer = require('webpack-theme-color-replacer')
const forElementUI = require('webpack-theme-color-replacer/forElementUI')
const dependencies = require('./dependencies')
// 拼接路径
const resolve = dir => require('path').join(__dirname, dir)
@ -17,28 +15,13 @@ process.env.VUE_APP_BUILD_TIME = require('dayjs')().format('YYYY-M-D HH:mm:ss')
// 基础路径 注意发布之前要先修改这里
let publicPath = process.env.VUE_APP_PUBLIC_PATH || '/'
const externals = {
'vue': 'Vue',
'vue-router': 'VueRouter',
'vuex': 'Vuex',
'@d2-projects/d2-crud': 'D2Crud',
'@d2-projects/vue-table-export': 'VueTableExport',
'@d2-projects/vue-table-import': 'VueTableImport'
}
let externals = {}
dependencies.forEach(package => { externals[package.name] = package.library })
// 引入文件的 cdn 链接
const cdn = {
css: [
'https://unpkg.com/element-ui@2.11.1/lib/theme-chalk/index.css'
],
js: [
'https://unpkg.com/vue@2.6.10/dist/vue.min.js',
'https://cdn.jsdelivr.net/npm/vue-router@3.0.6/dist/vue-router.min.js',
'https://cdn.jsdelivr.net/npm/vuex@3.1.1/dist/vuex.min.js',
'https://cdn.d2.pub/packages/@d2-projects/d2-crud@2.0.5/d2-crud.js',
'https://cdn.d2.pub/packages/@d2-projects/vue-table-export@1.0.1/vue-table-export.js',
'https://cdn.d2.pub/packages/@d2-projects/vue-table-import@1.0.0/vue-table-import.js'
]
css: dependencies.map(e => e.css).filter(e => e),
js: dependencies.map(e => e.js).filter(e => e)
}
module.exports = {