File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ yarn add @cnamts/vue-cli-plugin-proxy # OR npm install @cnamts/vue-cli-plugin-pr
57
57
module .exports = {
58
58
pluginOptions: {
59
59
proxy: {
60
+ enabled: true ,
60
61
context: ' ' ,
61
62
options: {
62
63
// ...
@@ -79,7 +80,8 @@ See [http-proxy-middleware](https://www.npmjs.com/package/http-proxy-middleware#
79
80
module .exports = {
80
81
pluginOptions: {
81
82
proxy: {
82
- context: ' /api' ,
83
+ enabled: true ,
84
+ context: ' /api' ,
83
85
options: {
84
86
target: ' http://www.example.org' ,
85
87
changeOrigin: true
@@ -96,7 +98,8 @@ module.exports = {
96
98
module .exports = {
97
99
pluginOptions: {
98
100
proxy: {
99
- context: [' /**' , ' !/dist/**' ],
101
+ enabled: true ,
102
+ context: [' /**' , ' !/dist/**' ],
100
103
options: {
101
104
target: ' http://127.0.0.1:8000' ,
102
105
}
@@ -107,4 +110,4 @@ module.exports = {
107
110
108
111
## License
109
112
110
- Vue CLI plugin proxy is licensed under a [ MIT License] ( ./LICENSE ) .
113
+ Vue CLI plugin proxy is licensed under a [ MIT License] ( ./LICENSE ) .
Original file line number Diff line number Diff line change 1
1
var proxy = require ( 'http-proxy-middleware' ) ;
2
2
3
3
module . exports = ( api , options ) => {
4
- api . configureDevServer ( ( app ) => {
5
- app . use ( proxy (
6
- options . pluginOptions . proxy . context ,
7
- options . pluginOptions . proxy . options
8
- ) ) ;
9
- } ) ;
4
+ const opts = options . pluginOptions . proxy
5
+ if ( opts && ( opts . enabled === undefined || opts . enabled ) ) {
6
+ api . configureDevServer ( ( app ) => {
7
+ app . use ( proxy (
8
+ opts . context ,
9
+ opts . options
10
+ ) ) ;
11
+ } ) ;
12
+ }
10
13
} ;
You can’t perform that action at this time.
0 commit comments