Skip to content

Commit b7262a9

Browse files
committed
🐛 Fix API
1 parent c9a7449 commit b7262a9

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ yarn add @cnamts/vue-cli-plugin-proxy # OR npm install @cnamts/vue-cli-plugin-pr
5757
module.exports = {
5858
pluginOptions: {
5959
proxy: {
60+
context: '',
6061
options: {
6162
// ...
6263
}
@@ -67,7 +68,42 @@ module.exports = {
6768

6869
### You're done! 🎉
6970

70-
See [http-proxy-middleware](https://www.npmjs.com/package/http-proxy-middleware#example) for `options` object to pass to the plugin.
71+
See [http-proxy-middleware](https://www.npmjs.com/package/http-proxy-middleware#tldr) for `options` object to pass to the plugin.
72+
73+
#### Object examples
74+
75+
* First example of the docs:
76+
77+
``` js
78+
// vue.config.js
79+
module.exports = {
80+
pluginOptions: {
81+
proxy: {
82+
context: '/api',
83+
options: {
84+
target: 'http://www.example.org',
85+
changeOrigin: true
86+
}
87+
}
88+
}
89+
}
90+
```
91+
92+
* v1.0.0 default:
93+
94+
``` js
95+
// vue.config.js
96+
module.exports = {
97+
pluginOptions: {
98+
proxy: {
99+
context: ['/**', '!/dist/**'],
100+
options: {
101+
target: 'http://127.0.0.1:8000',
102+
}
103+
}
104+
}
105+
}
106+
```
71107

72108
## License
73109

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ var proxy = require('http-proxy-middleware');
22

33
module.exports = api => {
44
api.configureDevServer((app) => {
5-
app.use(proxy(projectOptions.pluginOptions.proxy));
5+
app.use(proxy(projectOptions.pluginOptions.proxy.context, projectOptions.pluginOptions.proxy.options));
66
});
77
};

0 commit comments

Comments
 (0)