feat: upgrade dependency version
Showing
10 changed files
with
74 additions
and
306 deletions
| ... | @@ -3,259 +3,13 @@ module.exports = { | ... | @@ -3,259 +3,13 @@ module.exports = { |
| 3 | env: { | 3 | env: { |
| 4 | node: true | 4 | node: true |
| 5 | }, | 5 | }, |
| 6 | extends: ['plugin:vue/essential', 'eslint:recommended'], | 6 | extends: ['plugin:vue/essential', 'eslint:recommended', 'plugin:prettier/recommended'], |
| 7 | parserOptions: { | 7 | parserOptions: { |
| 8 | parser: 'babel-eslint' | 8 | parser: '@babel/eslint-parser' |
| 9 | }, | 9 | }, |
| 10 | rules: { | 10 | rules: { |
| 11 | 'vue/max-attributes-per-line': [ | 11 | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', |
| 12 | 2, | 12 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', |
| 13 | { | 13 | 'vue/multi-word-component-names': 'off' // 关闭名称校验 |
| 14 | singleline: 10, | ||
| 15 | multiline: { | ||
| 16 | max: 1, | ||
| 17 | allowFirstLine: false | ||
| 18 | } | ||
| 19 | } | ||
| 20 | ], | ||
| 21 | 'vue/singleline-html-element-content-newline': 'off', | ||
| 22 | 'vue/multiline-html-element-content-newline': 'off', | ||
| 23 | 'vue/name-property-casing': ['error', 'PascalCase'], | ||
| 24 | 'vue/no-v-html': 'off', | ||
| 25 | 'accessor-pairs': 2, | ||
| 26 | 'arrow-spacing': [ | ||
| 27 | 2, | ||
| 28 | { | ||
| 29 | before: true, | ||
| 30 | after: true | ||
| 31 | } | ||
| 32 | ], | ||
| 33 | 'block-spacing': [2, 'always'], | ||
| 34 | 'brace-style': [ | ||
| 35 | 2, | ||
| 36 | '1tbs', | ||
| 37 | { | ||
| 38 | allowSingleLine: true | ||
| 39 | } | ||
| 40 | ], | ||
| 41 | camelcase: [ | ||
| 42 | 0, | ||
| 43 | { | ||
| 44 | properties: 'always' | ||
| 45 | } | ||
| 46 | ], | ||
| 47 | 'comma-dangle': [2, 'never'], | ||
| 48 | 'comma-spacing': [ | ||
| 49 | 2, | ||
| 50 | { | ||
| 51 | before: false, | ||
| 52 | after: true | ||
| 53 | } | ||
| 54 | ], | ||
| 55 | 'comma-style': [2, 'last'], | ||
| 56 | 'constructor-super': 2, | ||
| 57 | curly: [2, 'multi-line'], | ||
| 58 | 'dot-location': [2, 'property'], | ||
| 59 | 'eol-last': 2, | ||
| 60 | eqeqeq: ['error', 'always', { null: 'ignore' }], | ||
| 61 | 'generator-star-spacing': [ | ||
| 62 | 2, | ||
| 63 | { | ||
| 64 | before: true, | ||
| 65 | after: true | ||
| 66 | } | ||
| 67 | ], | ||
| 68 | 'handle-callback-err': [2, '^(err|error)$'], | ||
| 69 | indent: [ | ||
| 70 | 2, | ||
| 71 | 2, | ||
| 72 | { | ||
| 73 | SwitchCase: 1 | ||
| 74 | } | ||
| 75 | ], | ||
| 76 | 'jsx-quotes': [2, 'prefer-single'], | ||
| 77 | 'key-spacing': [ | ||
| 78 | 2, | ||
| 79 | { | ||
| 80 | beforeColon: false, | ||
| 81 | afterColon: true | ||
| 82 | } | ||
| 83 | ], | ||
| 84 | 'keyword-spacing': [ | ||
| 85 | 2, | ||
| 86 | { | ||
| 87 | before: true, | ||
| 88 | after: true | ||
| 89 | } | ||
| 90 | ], | ||
| 91 | 'new-cap': [ | ||
| 92 | 2, | ||
| 93 | { | ||
| 94 | newIsCap: true, | ||
| 95 | capIsNew: false | ||
| 96 | } | ||
| 97 | ], | ||
| 98 | 'new-parens': 2, | ||
| 99 | 'no-array-constructor': 2, | ||
| 100 | 'no-caller': 2, | ||
| 101 | 'no-console': 'off', | ||
| 102 | 'no-class-assign': 2, | ||
| 103 | 'no-cond-assign': 2, | ||
| 104 | 'no-const-assign': 2, | ||
| 105 | 'no-control-regex': 0, | ||
| 106 | 'no-delete-var': 2, | ||
| 107 | 'no-dupe-args': 2, | ||
| 108 | 'no-dupe-class-members': 2, | ||
| 109 | 'no-dupe-keys': 2, | ||
| 110 | 'no-duplicate-case': 2, | ||
| 111 | 'no-empty-character-class': 2, | ||
| 112 | 'no-empty-pattern': 2, | ||
| 113 | 'no-eval': 2, | ||
| 114 | 'no-ex-assign': 2, | ||
| 115 | 'no-extend-native': 2, | ||
| 116 | 'no-extra-bind': 2, | ||
| 117 | 'no-extra-boolean-cast': 2, | ||
| 118 | 'no-extra-parens': [2, 'functions'], | ||
| 119 | 'no-fallthrough': 2, | ||
| 120 | 'no-floating-decimal': 2, | ||
| 121 | 'no-func-assign': 2, | ||
| 122 | 'no-implied-eval': 2, | ||
| 123 | 'no-inner-declarations': [2, 'functions'], | ||
| 124 | 'no-invalid-regexp': 2, | ||
| 125 | 'no-irregular-whitespace': 2, | ||
| 126 | 'no-iterator': 2, | ||
| 127 | 'no-label-var': 2, | ||
| 128 | 'no-labels': [ | ||
| 129 | 2, | ||
| 130 | { | ||
| 131 | allowLoop: false, | ||
| 132 | allowSwitch: false | ||
| 133 | } | ||
| 134 | ], | ||
| 135 | 'no-lone-blocks': 2, | ||
| 136 | 'no-mixed-spaces-and-tabs': 2, | ||
| 137 | 'no-multi-spaces': 2, | ||
| 138 | 'no-multi-str': 2, | ||
| 139 | 'no-multiple-empty-lines': [ | ||
| 140 | 2, | ||
| 141 | { | ||
| 142 | max: 1 | ||
| 143 | } | ||
| 144 | ], | ||
| 145 | 'no-native-reassign': 2, | ||
| 146 | 'no-negated-in-lhs': 2, | ||
| 147 | 'no-new-object': 2, | ||
| 148 | 'no-new-require': 2, | ||
| 149 | 'no-new-symbol': 2, | ||
| 150 | 'no-new-wrappers': 2, | ||
| 151 | 'no-obj-calls': 2, | ||
| 152 | 'no-octal': 2, | ||
| 153 | 'no-octal-escape': 2, | ||
| 154 | 'no-path-concat': 2, | ||
| 155 | 'no-proto': 2, | ||
| 156 | 'no-redeclare': 2, | ||
| 157 | 'no-regex-spaces': 2, | ||
| 158 | 'no-return-assign': [2, 'except-parens'], | ||
| 159 | 'no-self-assign': 2, | ||
| 160 | 'no-self-compare': 2, | ||
| 161 | 'no-sequences': 2, | ||
| 162 | 'no-shadow-restricted-names': 2, | ||
| 163 | 'no-spaced-func': 2, | ||
| 164 | 'no-sparse-arrays': 2, | ||
| 165 | 'no-this-before-super': 2, | ||
| 166 | 'no-throw-literal': 2, | ||
| 167 | 'no-trailing-spaces': 2, | ||
| 168 | 'no-undef': 2, | ||
| 169 | 'no-undef-init': 2, | ||
| 170 | 'no-unexpected-multiline': 2, | ||
| 171 | 'no-unmodified-loop-condition': 2, | ||
| 172 | 'no-unneeded-ternary': [ | ||
| 173 | 2, | ||
| 174 | { | ||
| 175 | defaultAssignment: false | ||
| 176 | } | ||
| 177 | ], | ||
| 178 | 'no-unreachable': 2, | ||
| 179 | 'no-unsafe-finally': 2, | ||
| 180 | 'no-unused-vars': [ | ||
| 181 | 2, | ||
| 182 | { | ||
| 183 | vars: 'all', | ||
| 184 | args: 'none' | ||
| 185 | } | ||
| 186 | ], | ||
| 187 | 'no-useless-call': 2, | ||
| 188 | 'no-useless-computed-key': 2, | ||
| 189 | 'no-useless-constructor': 2, | ||
| 190 | 'no-useless-escape': 0, | ||
| 191 | 'no-whitespace-before-property': 2, | ||
| 192 | 'no-with': 2, | ||
| 193 | 'one-var': [ | ||
| 194 | 2, | ||
| 195 | { | ||
| 196 | initialized: 'never' | ||
| 197 | } | ||
| 198 | ], | ||
| 199 | 'operator-linebreak': [ | ||
| 200 | 2, | ||
| 201 | 'after', | ||
| 202 | { | ||
| 203 | overrides: { | ||
| 204 | '?': 'before', | ||
| 205 | ':': 'before' | ||
| 206 | } | ||
| 207 | } | ||
| 208 | ], | ||
| 209 | 'padded-blocks': [2, 'never'], | ||
| 210 | quotes: [ | ||
| 211 | 2, | ||
| 212 | 'single', | ||
| 213 | { | ||
| 214 | avoidEscape: true, | ||
| 215 | allowTemplateLiterals: true | ||
| 216 | } | ||
| 217 | ], | ||
| 218 | semi: [2, 'never'], | ||
| 219 | 'semi-spacing': [ | ||
| 220 | 2, | ||
| 221 | { | ||
| 222 | before: false, | ||
| 223 | after: true | ||
| 224 | } | ||
| 225 | ], | ||
| 226 | 'space-before-blocks': [2, 'always'], | ||
| 227 | 'space-before-function-paren': [2, 'never'], | ||
| 228 | 'space-in-parens': [2, 'never'], | ||
| 229 | 'space-infix-ops': 2, | ||
| 230 | 'space-unary-ops': [ | ||
| 231 | 2, | ||
| 232 | { | ||
| 233 | words: true, | ||
| 234 | nonwords: false | ||
| 235 | } | ||
| 236 | ], | ||
| 237 | 'spaced-comment': [ | ||
| 238 | 2, | ||
| 239 | 'always', | ||
| 240 | { | ||
| 241 | markers: ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','] | ||
| 242 | } | ||
| 243 | ], | ||
| 244 | 'template-curly-spacing': [2, 'never'], | ||
| 245 | 'use-isnan': 2, | ||
| 246 | 'valid-typeof': 2, | ||
| 247 | 'wrap-iife': [2, 'any'], | ||
| 248 | 'yield-star-spacing': [2, 'both'], | ||
| 249 | yoda: [2, 'never'], | ||
| 250 | 'prefer-const': 2, | ||
| 251 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, | ||
| 252 | 'object-curly-spacing': [ | ||
| 253 | 2, | ||
| 254 | 'always', | ||
| 255 | { | ||
| 256 | objectsInObjects: false | ||
| 257 | } | ||
| 258 | ], | ||
| 259 | 'array-bracket-spacing': [2, 'never'] | ||
| 260 | } | 14 | } |
| 261 | } | 15 | } | ... | ... |
jsconfig.json
0 → 100644
| ... | @@ -5,38 +5,43 @@ | ... | @@ -5,38 +5,43 @@ |
| 5 | "author": "Sunnie <sunniejs@163.com>", | 5 | "author": "Sunnie <sunniejs@163.com>", |
| 6 | "private": true, | 6 | "private": true, |
| 7 | "scripts": { | 7 | "scripts": { |
| 8 | "serve": "vue-cli-service serve --open", | 8 | "serve": "vue-cli-service serve", |
| 9 | "build": "vue-cli-service build", | 9 | "build": "vue-cli-service build", |
| 10 | "stage": "vue-cli-service build --mode staging", | 10 | "stage": "vue-cli-service build --mode staging", |
| 11 | "lint": "vue-cli-service lint" | 11 | "lint": "vue-cli-service lint", |
| 12 | "deps": "yarn upgrade-interactive --latest" | ||
| 12 | }, | 13 | }, |
| 13 | "dependencies": { | 14 | "dependencies": { |
| 14 | "axios": "^0.19.2", | 15 | "axios": "^0.27.2", |
| 15 | "core-js": "^3.6.4", | 16 | "core-js": "^3.8.3", |
| 16 | "lib-flexible": "^0.3.2", | 17 | "lib-flexible": "^0.3.2", |
| 17 | "lodash": "^4.17.15", | ||
| 18 | "regenerator-runtime": "^0.13.5", | 18 | "regenerator-runtime": "^0.13.5", |
| 19 | "vant": "^2.10.2", | 19 | "vant": "^2.10.2", |
| 20 | "vue": "^2.6.11", | 20 | "vue": "^2.6.14", |
| 21 | "vue-router": "^3.2.0", | 21 | "vue-router": "^3.5.1", |
| 22 | "vuex": "^3.4.0" | 22 | "vuex": "^3.6.2" |
| 23 | }, | 23 | }, |
| 24 | "devDependencies": { | 24 | "devDependencies": { |
| 25 | "@vue/cli-plugin-babel": "~4.5.0", | 25 | "@babel/core": "^7.12.16", |
| 26 | "@vue/cli-plugin-eslint": "~4.5.0", | 26 | "@babel/eslint-parser": "^7.12.16", |
| 27 | "@vue/cli-plugin-router": "~4.5.0", | 27 | "@vue/cli-plugin-babel": "~5.0.0", |
| 28 | "@vue/cli-plugin-vuex": "~4.5.0", | 28 | "@vue/cli-plugin-eslint": "~5.0.0", |
| 29 | "@vue/cli-service": "~4.5.0", | 29 | "@vue/cli-plugin-router": "~5.0.0", |
| 30 | "@vue/cli-plugin-vuex": "~5.0.0", | ||
| 31 | "@vue/cli-service": "~5.0.0", | ||
| 30 | "babel-eslint": "^10.1.0", | 32 | "babel-eslint": "^10.1.0", |
| 31 | "babel-plugin-import": "^1.13.0", | 33 | "babel-plugin-import": "^1.13.0", |
| 32 | "babel-plugin-transform-remove-console": "^6.9.4", | 34 | "babel-plugin-transform-remove-console": "^6.9.4", |
| 33 | "eslint": "^6.7.2", | 35 | "eslint": "^7.32.0", |
| 34 | "eslint-plugin-vue": "^6.2.2", | 36 | "eslint-config-prettier": "^8.3.0", |
| 35 | "node-sass": "^4.14.1", | 37 | "eslint-plugin-prettier": "^4.0.0", |
| 36 | "postcss-pxtorem": "^5.1.1", | 38 | "eslint-plugin-vue": "^8.0.3", |
| 37 | "sass-loader": "^8.0.2", | 39 | "prettier": "^2.4.1", |
| 40 | "postcss-pxtorem": "^6.0.0", | ||
| 41 | "sass": "^1.32.7", | ||
| 42 | "sass-loader": "^12.0.0", | ||
| 38 | "script-ext-html-webpack-plugin": "^2.1.4", | 43 | "script-ext-html-webpack-plugin": "^2.1.4", |
| 39 | "vue-template-compiler": "^2.6.11", | 44 | "vue-template-compiler": "^2.6.14", |
| 40 | "webpack-bundle-analyzer": "^3.8.0" | 45 | "webpack-bundle-analyzer": "^3.8.0" |
| 41 | } | 46 | } |
| 42 | } | 47 | } | ... | ... |
| ... | @@ -17,10 +17,10 @@ export function parseTime(time, cFormat) { | ... | @@ -17,10 +17,10 @@ export function parseTime(time, cFormat) { |
| 17 | if (typeof time === 'object') { | 17 | if (typeof time === 'object') { |
| 18 | date = time | 18 | date = time |
| 19 | } else { | 19 | } else { |
| 20 | if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { | 20 | if (typeof time === 'string' && /^[0-9]+$/.test(time)) { |
| 21 | time = parseInt(time) | 21 | time = parseInt(time) |
| 22 | } | 22 | } |
| 23 | if ((typeof time === 'number') && (time.toString().length === 10)) { | 23 | if (typeof time === 'number' && time.toString().length === 10) { |
| 24 | time = time * 1000 | 24 | time = time * 1000 |
| 25 | } | 25 | } |
| 26 | date = new Date(time) | 26 | date = new Date(time) |
| ... | @@ -37,7 +37,9 @@ export function parseTime(time, cFormat) { | ... | @@ -37,7 +37,9 @@ export function parseTime(time, cFormat) { |
| 37 | const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { | 37 | const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { |
| 38 | let value = formatObj[key] | 38 | let value = formatObj[key] |
| 39 | // Note: getDay() returns 0 on Sunday | 39 | // Note: getDay() returns 0 on Sunday |
| 40 | if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] } | 40 | if (key === 'a') { |
| 41 | return ['日', '一', '二', '三', '四', '五', '六'][value] | ||
| 42 | } | ||
| 41 | if (result.length > 0 && value < 10) { | 43 | if (result.length > 0 && value < 10) { |
| 42 | value = '0' + value | 44 | value = '0' + value |
| 43 | } | 45 | } |
| ... | @@ -75,17 +77,7 @@ export function formatTime(time, option) { | ... | @@ -75,17 +77,7 @@ export function formatTime(time, option) { |
| 75 | if (option) { | 77 | if (option) { |
| 76 | return parseTime(time, option) | 78 | return parseTime(time, option) |
| 77 | } else { | 79 | } else { |
| 78 | return ( | 80 | return d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分' |
| 79 | d.getMonth() + | ||
| 80 | 1 + | ||
| 81 | '月' + | ||
| 82 | d.getDate() + | ||
| 83 | '日' + | ||
| 84 | d.getHours() + | ||
| 85 | '时' + | ||
| 86 | d.getMinutes() + | ||
| 87 | '分' | ||
| 88 | ) | ||
| 89 | } | 81 | } |
| 90 | } | 82 | } |
| 91 | 83 | ||
| ... | @@ -100,11 +92,7 @@ export function param2Obj(url) { | ... | @@ -100,11 +92,7 @@ export function param2Obj(url) { |
| 100 | } | 92 | } |
| 101 | return JSON.parse( | 93 | return JSON.parse( |
| 102 | '{"' + | 94 | '{"' + |
| 103 | decodeURIComponent(search) | 95 | decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"').replace(/\+/g, ' ') + |
| 104 | .replace(/"/g, '\\"') | ||
| 105 | .replace(/&/g, '","') | ||
| 106 | .replace(/=/g, '":"') | ||
| 107 | .replace(/\+/g, ' ') + | ||
| 108 | '"}' | 96 | '"}' |
| 109 | ) | 97 | ) |
| 110 | } | 98 | } | ... | ... |
| 1 | <!-- home --> | ||
| 2 | <template> | 1 | <template> |
| 3 | <div class="about-container"> | 2 | <div class="about-container"> |
| 4 | <div class="warpper"> | 3 | <div class="warpper"> |
| ... | @@ -46,14 +45,14 @@ export default { | ... | @@ -46,14 +45,14 @@ export default { |
| 46 | // 请求接口数据,仅作为展示,需要配置src->config下环境文件 | 45 | // 请求接口数据,仅作为展示,需要配置src->config下环境文件 |
| 47 | const params = { user: 'sunnie' } | 46 | const params = { user: 'sunnie' } |
| 48 | getUserInfo(params) | 47 | getUserInfo(params) |
| 49 | .then(() => { }) | 48 | .then(() => {}) |
| 50 | .catch(() => { }) | 49 | .catch(() => {}) |
| 51 | }, | 50 | }, |
| 52 | // Action 通过 store.dispatch 方法触发 | 51 | // Action 通过 store.dispatch 方法触发 |
| 53 | doDispatch() { | 52 | doDispatch() { |
| 54 | this.$store.dispatch('setUserName', '真乖,赶紧关注公众号,组织都在等你~') | 53 | this.$store.dispatch('setUserName', '真乖,赶紧关注公众号,组织都在等你~') |
| 55 | }, | 54 | }, |
| 56 | goGithub(index) { | 55 | goGithub() { |
| 57 | window.location.href = 'https://github.com/sunniejs/vue-h5-template' | 56 | window.location.href = 'https://github.com/sunniejs/vue-h5-template' |
| 58 | } | 57 | } |
| 59 | } | 58 | } |
| ... | @@ -97,7 +96,7 @@ export default { | ... | @@ -97,7 +96,7 @@ export default { |
| 97 | .logo { | 96 | .logo { |
| 98 | width: 120px; | 97 | width: 120px; |
| 99 | height: 120px; | 98 | height: 120px; |
| 100 | background: url($cdn+'/weapp/logo.png') center / contain no-repeat; | 99 | background: url($cdn + '/weapp/logo.png') center / contain no-repeat; |
| 101 | } | 100 | } |
| 102 | .wechat { | 101 | .wechat { |
| 103 | width: 200px; | 102 | width: 200px; | ... | ... |
| 1 | <!-- home --> | ||
| 2 | <template> | 1 | <template> |
| 3 | <div class="index-container"> | 2 | <div class="index-container"> |
| 4 | <div class="warpper"> | 3 | <div class="warpper"> |
| 5 | <h1 class="demo-home__title"><img src="https://www.sunniejs.cn/static/weapp/logo.png" /><span> VUE H5开发模板</span></h1> | 4 | <h1 class="demo-home__title"> |
| 6 | <h2 class="demo-home__desc"> | 5 | <img src="https://www.sunniejs.cn/static/weapp/logo.png" /><span> VUE H5开发模板</span> |
| 7 | A vue h5 template with Vant UI | 6 | </h1> |
| 8 | </h2> | 7 | <h2 class="demo-home__desc">A vue h5 template with Vant UI</h2> |
| 9 | </div> | 8 | </div> |
| 10 | <van-cell icon="success" v-for="item in list" :key="item" :title="item" /> | 9 | <van-cell icon="success" v-for="item in list" :key="item" :title="item" /> |
| 11 | </div> | 10 | </div> |
| ... | @@ -39,7 +38,7 @@ export default { | ... | @@ -39,7 +38,7 @@ export default { |
| 39 | 38 | ||
| 40 | computed: {}, | 39 | computed: {}, |
| 41 | 40 | ||
| 42 | mounted() { }, | 41 | mounted() {}, |
| 43 | 42 | ||
| 44 | methods: {} | 43 | methods: {} |
| 45 | } | 44 | } | ... | ... |
| 1 | 'use strict' | ||
| 2 | const path = require('path') | 1 | const path = require('path') |
| 3 | const defaultSettings = require('./src/config/index.js') | 2 | const defaultSettings = require('./src/config/index.js') |
| 4 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin | 3 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin |
| ... | @@ -8,6 +7,8 @@ const resolve = dir => path.join(__dirname, dir) | ... | @@ -8,6 +7,8 @@ const resolve = dir => path.join(__dirname, dir) |
| 8 | const name = defaultSettings.title || 'vue mobile template' | 7 | const name = defaultSettings.title || 'vue mobile template' |
| 9 | // 生产环境,测试和正式 | 8 | // 生产环境,测试和正式 |
| 10 | const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV) | 9 | const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV) |
| 10 | |||
| 11 | const { defineConfig } = require('@vue/cli-service') | ||
| 11 | // externals | 12 | // externals |
| 12 | // const externals = { | 13 | // const externals = { |
| 13 | // vue: 'Vue', | 14 | // vue: 'Vue', |
| ... | @@ -36,7 +37,7 @@ const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV) | ... | @@ -36,7 +37,7 @@ const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV) |
| 36 | // } | 37 | // } |
| 37 | // } | 38 | // } |
| 38 | 39 | ||
| 39 | module.exports = { | 40 | module.exports = defineConfig({ |
| 40 | publicPath: './', // 署应用包时的基本 URL。 vue-router hash 模式使用 | 41 | publicPath: './', // 署应用包时的基本 URL。 vue-router hash 模式使用 |
| 41 | // publicPath: '/app/', //署应用包时的基本 URL。 vue-router history模式使用 | 42 | // publicPath: '/app/', //署应用包时的基本 URL。 vue-router history模式使用 |
| 42 | outputDir: 'dist', // 生产环境构建文件的目录 | 43 | outputDir: 'dist', // 生产环境构建文件的目录 |
| ... | @@ -46,11 +47,13 @@ module.exports = { | ... | @@ -46,11 +47,13 @@ module.exports = { |
| 46 | devServer: { | 47 | devServer: { |
| 47 | port: 9020, // 端口 | 48 | port: 9020, // 端口 |
| 48 | open: false, // 启动后打开浏览器 | 49 | open: false, // 启动后打开浏览器 |
| 50 | client: { | ||
| 49 | overlay: { | 51 | overlay: { |
| 50 | // 当出现编译器错误或警告时,在浏览器中显示全屏覆盖层 | 52 | // 当出现编译器错误或警告时,在浏览器中显示全屏覆盖层 |
| 51 | warnings: false, | 53 | warnings: false, |
| 52 | errors: true | 54 | errors: true |
| 53 | } | 55 | } |
| 56 | } | ||
| 54 | // proxy: { | 57 | // proxy: { |
| 55 | // //配置跨域 | 58 | // //配置跨域 |
| 56 | // '/api': { | 59 | // '/api': { |
| ... | @@ -70,7 +73,7 @@ module.exports = { | ... | @@ -70,7 +73,7 @@ module.exports = { |
| 70 | scss: { | 73 | scss: { |
| 71 | // 向全局sass样式传入共享的全局变量, $src可以配置图片cdn前缀 | 74 | // 向全局sass样式传入共享的全局变量, $src可以配置图片cdn前缀 |
| 72 | // 详情: https://cli.vuejs.org/guide/css.html#passing-options-to-pre-processor-loaders | 75 | // 详情: https://cli.vuejs.org/guide/css.html#passing-options-to-pre-processor-loaders |
| 73 | prependData: ` | 76 | additionalData: ` |
| 74 | @import "assets/css/mixin.scss"; | 77 | @import "assets/css/mixin.scss"; |
| 75 | @import "assets/css/variables.scss"; | 78 | @import "assets/css/variables.scss"; |
| 76 | $cdn: "${defaultSettings.$cdn}"; | 79 | $cdn: "${defaultSettings.$cdn}"; |
| ... | @@ -176,4 +179,4 @@ module.exports = { | ... | @@ -176,4 +179,4 @@ module.exports = { |
| 176 | config.optimization.runtimeChunk('single') | 179 | config.optimization.runtimeChunk('single') |
| 177 | }) | 180 | }) |
| 178 | } | 181 | } |
| 179 | } | 182 | }) | ... | ... |
-
Please register or sign in to post a comment