From f5c14f23fae0cf8fcce19c253c294ee527c1bf28 Mon Sep 17 00:00:00 2001 From: FairyEver <1711467488@qq.com> Date: Fri, 13 Dec 2019 11:11:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20cdn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: c8ae44e41431eaea271dc9a540b42f2989973c63 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 --- dependencies.js | 50 ++++++++++++++++++++++++++++++++ package-lock.json.REMOVED.git-id | 2 +- package.json | 10 +++---- src/router/index.js | 4 +-- vue.config.js | 27 ++++------------- 5 files changed, 63 insertions(+), 30 deletions(-) create mode 100644 dependencies.js diff --git a/dependencies.js b/dependencies.js new file mode 100644 index 00000000..c6761816 --- /dev/null +++ b/dependencies.js @@ -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' + } +] \ No newline at end of file diff --git a/package-lock.json.REMOVED.git-id b/package-lock.json.REMOVED.git-id index 9f57a3ba..019a81a8 100644 --- a/package-lock.json.REMOVED.git-id +++ b/package-lock.json.REMOVED.git-id @@ -1 +1 @@ -975a87cbfa94ae0055fa5dbbf387398b44b8c8f0 \ No newline at end of file +aff59b5ca2c032fa2b8d57ed2c330018047d3263 \ No newline at end of file diff --git a/package.json b/package.json index 9b98f77b..92d12744 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/src/router/index.js b/src/router/index.js index 50da5de0..034351d3 100755 --- a/src/router/index.js +++ b/src/router/index.js @@ -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) diff --git a/vue.config.js b/vue.config.js index 8bb287d2..1b95613c 100644 --- a/vue.config.js +++ b/vue.config.js @@ -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 = {