From 160a8d30735cdfb9a68316b1f5f97448b55b8bf1 Mon Sep 17 00:00:00 2001 From: zema1 Date: Mon, 16 Oct 2017 17:12:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=B9=85=E7=BC=A9=E5=87=8Fbuild?= =?UTF-8?q?=E4=BD=93=E7=A7=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oj/build/webpack.base.conf.js | 10 +- oj/package-lock.json | 26 ++-- oj/package.json | 4 +- oj/src/components/CodeMirror.vue | 221 ++++++++++++++++--------------- oj/src/components/Highlight.vue | 2 +- oj/src/main.js | 44 +++++- oj/src/views/problem/Problem.vue | 5 +- 7 files changed, 172 insertions(+), 140 deletions(-) diff --git a/oj/build/webpack.base.conf.js b/oj/build/webpack.base.conf.js index 689431a..f43ccde 100644 --- a/oj/build/webpack.base.conf.js +++ b/oj/build/webpack.base.conf.js @@ -1,5 +1,6 @@ var path = require('path') var utils = require('./utils') +var webpack = require('webpack') var config = require('../config') var vueLoaderConfig = require('./vue-loader.conf') @@ -19,6 +20,7 @@ module.exports = { : config.dev.assetsPublicPath }, resolve: { + modules: ['node_modules'], extensions: ['.js', '.vue', '.json'], alias: { 'vue$': 'vue/dist/vue.esm.js', @@ -45,7 +47,8 @@ module.exports = { }, { test: /\.js$/, - loader: 'babel-loader', + loader: 'babel-loader?cacheDirectory', + exclude: /node_modules/, include: [resolve('src'), resolve('test')] }, { @@ -65,5 +68,8 @@ module.exports = { } } ] - } + }, + plugins: [ + new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /zh-cn/) + ] } diff --git a/oj/package-lock.json b/oj/package-lock.json index 11a5c4d..3576bfa 100644 --- a/oj/package-lock.json +++ b/oj/package-lock.json @@ -1886,9 +1886,9 @@ "dev": true }, "codemirror": { - "version": "5.28.0", - "resolved": "http://registry.npm.taobao.org/codemirror/download/codemirror-5.28.0.tgz", - "integrity": "sha1-KXjZKA1nE1Gk9XN9BrvWgaD9b4M=" + "version": "5.30.0", + "resolved": "http://registry.npm.taobao.org/codemirror/download/codemirror-5.30.0.tgz", + "integrity": "sha1-huV91epVNay8+ccgeXtM7+BbWnA=" }, "color": { "version": "0.11.4", @@ -4491,7 +4491,7 @@ }, "highlight.js": { "version": "9.12.0", - "resolved": "http://registry.npm.taobao.org/highlight.js/download/highlight.js-9.12.0.tgz", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.12.0.tgz", "integrity": "sha1-5tnb5Xy+/mB1HwKvM2GVhwyQwB4=" }, "hmac-drbg": { @@ -8027,12 +8027,12 @@ "resolved": "http://registry.npm.taobao.org/vue/download/vue-2.4.4.tgz", "integrity": "sha1-6pVQuWpxRl/SuLF7YWc7NWGGF4k=" }, - "vue-codemirror": { - "version": "3.1.4", - "resolved": "http://registry.npm.taobao.org/vue-codemirror/download/vue-codemirror-3.1.4.tgz", - "integrity": "sha1-2vX1Z9H3Uy7kW65IuGP5tiH0KVg=", + "vue-codemirror-lite": { + "version": "1.0.2", + "resolved": "http://registry.npm.taobao.org/vue-codemirror-lite/download/vue-codemirror-lite-1.0.2.tgz", + "integrity": "sha1-7mxnlom3I7OvOANChG/E/c5rf7Y=", "requires": { - "codemirror": "5.28.0" + "codemirror": "5.30.0" } }, "vue-cropper": { @@ -8049,14 +8049,6 @@ "lodash.debounce": "4.0.8" } }, - "vue-highlightjs": { - "version": "1.3.3", - "resolved": "http://registry.npm.taobao.org/vue-highlightjs/download/vue-highlightjs-1.3.3.tgz", - "integrity": "sha1-KaDVcTL8HOFc+mHolpGPW3GMXVI=", - "requires": { - "highlight.js": "9.12.0" - } - }, "vue-hot-reload-api": { "version": "2.1.0", "resolved": "http://registry.npm.taobao.org/vue-hot-reload-api/download/vue-hot-reload-api-2.1.0.tgz", diff --git a/oj/package.json b/oj/package.json index 7de4b20..58e427b 100644 --- a/oj/package.json +++ b/oj/package.json @@ -14,14 +14,14 @@ "axios": "^0.16.2", "browser-detect": "^0.2.18", "echarts": "^3.6.2", + "highlight.js": "^9.12.0", "i": "^0.3.5", "iview": "^2.3.2", "moment": "^2.18.1", "vue": "^2.4.4", - "vue-codemirror": "^3.1.4", + "vue-codemirror-lite": "^1.0.2", "vue-cropper": "^0.2.1", "vue-echarts": "^2.4.1", - "vue-highlightjs": "^1.3.3", "vue-router": "^2.7.0", "vuex": "^2.4.0", "vuex-router-sync": "^4.3.2" diff --git a/oj/src/components/CodeMirror.vue b/oj/src/components/CodeMirror.vue index 0f3938c..c640224 100644 --- a/oj/src/components/CodeMirror.vue +++ b/oj/src/components/CodeMirror.vue @@ -2,135 +2,138 @@
-
- Language: - -
+
+ Language: + +
-
- Theme: - -
+
+ Theme: + +
- +
diff --git a/oj/src/components/Highlight.vue b/oj/src/components/Highlight.vue index 43824c5..65b0551 100644 --- a/oj/src/components/Highlight.vue +++ b/oj/src/components/Highlight.vue @@ -1,5 +1,5 @@