Skip to content

Commit e1be4a2

Browse files
committed
✨ Use projectOptions
1 parent 4f17937 commit e1be4a2

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<h1 align="center">CNAM – Vue CLI plugin proxy</h1>
1616

17-
<p align="center">This plugin is meant to provide all http-proxy-middleware options to vue-cli.</p>
17+
<p align="center">This plugin is meant to provide all [http-proxy-middleware](https://www.npmjs.com/package/http-proxy-middleware) options to vue-cli.</p>
1818

1919
<p align="center">
2020
<a href="https://www.npmjs.com/package/@cnamts/vue-cli-plugin-proxy">
@@ -38,6 +38,10 @@
3838
</a>
3939
</p>
4040

41+
## Issue
42+
43+
See the issue than initiated this plugin: [#2320](https://github.com/vuejs/vue-cli/issues/2320)
44+
4145
## As Easy as 1, 2, 3
4246

4347
### Install
@@ -46,26 +50,24 @@
4650
yarn add @cnamts/vue-cli-plugin-proxy # OR npm install @cnamts/vue-cli-plugin-proxy
4751
```
4852

49-
### Load
50-
51-
``` ts
52-
// main.ts
53-
import Vue from 'vue';
54-
import '@cnamts/vue-cli-plugin-proxy';
53+
### Use
5554

56-
new Vue({
57-
render: (h) => h(App)
58-
}).$mount('#app');
55+
``` js
56+
// vue.config.js
57+
module.exports = {
58+
pluginOptions: {
59+
proxy: {
60+
options: {
61+
// ...
62+
}
63+
}
64+
}
65+
}
5966
```
6067

6168
### You're done! 🎉
6269

63-
``` bash
64-
# run your project
65-
yarn serve # OR your own command
66-
```
67-
68-
It automatically load all components and directives of the library and made them available globally.
70+
See [http-proxy-middleware](https://www.npmjs.com/package/http-proxy-middleware#example) for `options` object to pass to the plugin.
6971

7072
## License
7173

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(['/**', '!/dist/**'], { target: 'http://127.0.0.1:8000' }));
5+
app.use(proxy(projectOptions.pluginOptions.proxy));
66
});
77
};

0 commit comments

Comments
 (0)