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 = {