mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-09-06 17:49:50 +08:00
refine config
This commit is contained in:
parent
3a796471c3
commit
35cc995c1b
@ -1,9 +1,14 @@
|
|||||||
VUE_APP_BASE_API = '/api'
|
# just a flag
|
||||||
ENV = 'development'
|
ENV = 'development'
|
||||||
|
|
||||||
// With this configuration, vue-cli uses babel-plugin-dynamic-import-node
|
# base api
|
||||||
// It only does one thing by converting all import() to require()
|
VUE_APP_BASE_API = '/dev-api'
|
||||||
// So that all asynchronous components can be import synchronously using this plugin
|
|
||||||
// This configuration can significantly increase the speed of hot updates when you have a large number of pages
|
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
|
||||||
// https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js
|
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.
|
||||||
|
# It only does one thing by converting all import() to require().
|
||||||
|
# This configuration can significantly increase the speed of hot updates,
|
||||||
|
# when you have a large number of pages.
|
||||||
|
# Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js
|
||||||
|
|
||||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||||
|
@ -1,2 +1,6 @@
|
|||||||
VUE_APP_BASE_API = '/api'
|
# just a flag
|
||||||
ENV = 'production'
|
ENV = 'production'
|
||||||
|
|
||||||
|
# base api
|
||||||
|
VUE_APP_BASE_API = '/prod-api'
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
NODE_ENV=production
|
NODE_ENV = production
|
||||||
VUE_APP_BASE_API = '/api'
|
|
||||||
|
# just a flag
|
||||||
ENV = 'staging'
|
ENV = 'staging'
|
||||||
|
|
||||||
|
# base api
|
||||||
|
VUE_APP_BASE_API = '/stage-api'
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
build/*.js
|
build/*.js
|
||||||
config/*.js
|
config/*.js
|
||||||
src/assets
|
src/assets
|
||||||
|
public
|
||||||
|
@ -237,7 +237,7 @@ export default {
|
|||||||
|
|
||||||
.dropzone .dz-preview:hover .dz-image img {
|
.dropzone .dz-preview:hover .dz-image img {
|
||||||
transform: none;
|
transform: none;
|
||||||
-webkit-filter: none;
|
filter: none;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,22 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const pkg = require('./package.json')
|
||||||
|
|
||||||
function resolve(dir) {
|
function resolve(dir) {
|
||||||
return path.join(__dirname, dir)
|
return path.join(__dirname, dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
const name = 'vue-element-admin'
|
const name = pkg.name || 'vue-element-admin' // page title
|
||||||
const port = 9527 // dev port
|
const port = 9527 // dev port
|
||||||
|
|
||||||
// Explanation of each configuration item You can find it in https://cli.vuejs.org/config/
|
// All configuration item explanations can be find in https://cli.vuejs.org/config/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
/**
|
/**
|
||||||
* You can set by yourself according to actual condition
|
* You will need to set publicPath if you plan to deploy your site under a sub path,
|
||||||
* You will need to set this if you plan to deploy your site under a sub path,
|
* for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/,
|
||||||
* for example GitHub pages. If you plan to deploy your site to https://foo.github.io/bar/,
|
* then publicPath should be set to "/bar/".
|
||||||
* then assetsPublicPath should be set to "/bar/".
|
|
||||||
* In most cases please use '/' !!!
|
* In most cases please use '/' !!!
|
||||||
* Detail https://cli.vuejs.org/config/#publicPath
|
* Detail: https://cli.vuejs.org/config/#publicpath
|
||||||
*/
|
*/
|
||||||
publicPath: '/',
|
publicPath: '/',
|
||||||
outputDir: 'dist',
|
outputDir: 'dist',
|
||||||
@ -32,11 +31,13 @@ module.exports = {
|
|||||||
errors: true
|
errors: true
|
||||||
},
|
},
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
// Detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||||
|
// xxx-api/login => mock/login
|
||||||
|
[process.env.VUE_APP_BASE_API]: {
|
||||||
target: `http://localhost:${port}/mock`,
|
target: `http://localhost:${port}/mock`,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
'^/api': ''
|
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -58,7 +59,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
configureWebpack: {
|
configureWebpack: {
|
||||||
// We provide the app's title in Webpack's name field, so that
|
// provide the app's title in webpack's name field, so that
|
||||||
// it can be accessed in index.html to inject the correct title.
|
// it can be accessed in index.html to inject the correct title.
|
||||||
name: name,
|
name: name,
|
||||||
resolve: {
|
resolve: {
|
||||||
@ -94,6 +95,7 @@ module.exports = {
|
|||||||
return options
|
return options
|
||||||
})
|
})
|
||||||
.end()
|
.end()
|
||||||
|
|
||||||
config
|
config
|
||||||
.when(process.env.NODE_ENV === 'development',
|
.when(process.env.NODE_ENV === 'development',
|
||||||
config => config.devtool('cheap-source-map')
|
config => config.devtool('cheap-source-map')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user