Skip to content

Commit 35cc995

Browse files
committed
refine config
1 parent 3a79647 commit 35cc995

File tree

6 files changed

+38
-21
lines changed

6 files changed

+38
-21
lines changed

.env.development

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
VUE_APP_BASE_API = '/api'
1+
# just a flag
22
ENV = 'development'
33

4-
// With this configuration, vue-cli uses babel-plugin-dynamic-import-node
5-
// It only does one thing by converting all import() to require()
6-
// So that all asynchronous components can be import synchronously using this plugin
7-
// This configuration can significantly increase the speed of hot updates when you have a large number of pages
8-
// https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js
4+
# base api
5+
VUE_APP_BASE_API = '/dev-api'
6+
7+
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
8+
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.
9+
# It only does one thing by converting all import() to require().
10+
# This configuration can significantly increase the speed of hot updates,
11+
# when you have a large number of pages.
12+
# Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js
13+
914
VUE_CLI_BABEL_TRANSPILE_MODULES = true

.env.production

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
VUE_APP_BASE_API = '/api'
1+
# just a flag
22
ENV = 'production'
3+
4+
# base api
5+
VUE_APP_BASE_API = '/prod-api'
6+

.env.staging

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
NODE_ENV=production
2-
VUE_APP_BASE_API = '/api'
1+
NODE_ENV = production
2+
3+
# just a flag
34
ENV = 'staging'
5+
6+
# base api
7+
VUE_APP_BASE_API = '/stage-api'
8+

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
build/*.js
22
config/*.js
33
src/assets
4+
public

src/components/Dropzone/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ export default {
237237
238238
.dropzone .dz-preview:hover .dz-image img {
239239
transform: none;
240-
-webkit-filter: none;
240+
filter: none;
241241
width: 100%;
242242
height: 100%;
243243
}

vue.config.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
'use strict'
2-
32
const path = require('path')
3+
const pkg = require('./package.json')
44

55
function resolve(dir) {
66
return path.join(__dirname, dir)
77
}
88

9-
const name = 'vue-element-admin'
9+
const name = pkg.name || 'vue-element-admin' // page title
1010
const port = 9527 // dev port
1111

12-
// Explanation of each configuration item You can find it in https://cli.vuejs.org/config/
12+
// All configuration item explanations can be find in https://cli.vuejs.org/config/
1313
module.exports = {
1414
/**
15-
* You can set by yourself according to actual condition
16-
* You will need to set this if you plan to deploy your site under a sub path,
17-
* for example GitHub pages. If you plan to deploy your site to https://foo.github.io/bar/,
18-
* then assetsPublicPath should be set to "/bar/".
15+
* You will need to set publicPath if you plan to deploy your site under a sub path,
16+
* for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/,
17+
* then publicPath should be set to "/bar/".
1918
* In most cases please use '/' !!!
20-
* Detail https://cli.vuejs.org/config/#publicPath
19+
* Detail: https://cli.vuejs.org/config/#publicpath
2120
*/
2221
publicPath: '/',
2322
outputDir: 'dist',
@@ -32,11 +31,13 @@ module.exports = {
3231
errors: true
3332
},
3433
proxy: {
35-
'/api': {
34+
// Detail: https://cli.vuejs.org/config/#devserver-proxy
35+
// xxx-api/login => mock/login
36+
[process.env.VUE_APP_BASE_API]: {
3637
target: `http://localhost:${port}/mock`,
3738
changeOrigin: true,
3839
pathRewrite: {
39-
'^/api': ''
40+
['^' + process.env.VUE_APP_BASE_API]: ''
4041
}
4142
}
4243
},
@@ -58,7 +59,7 @@ module.exports = {
5859
}
5960
},
6061
configureWebpack: {
61-
// We provide the app's title in Webpack's name field, so that
62+
// provide the app's title in webpack's name field, so that
6263
// it can be accessed in index.html to inject the correct title.
6364
name: name,
6465
resolve: {
@@ -94,6 +95,7 @@ module.exports = {
9495
return options
9596
})
9697
.end()
98+
9799
config
98100
.when(process.env.NODE_ENV === 'development',
99101
config => config.devtool('cheap-source-map')

0 commit comments

Comments
 (0)