rollup-plugin-serve
rollup-plugin-serve copied to clipboard
Route api calls to backend
Great plugin! Is it possible to route API-calls to the real backend, for instance localhost:3000 like this https://vuejs-templates.github.io/webpack/proxy.html?
Currently it's not, but I will accept PRs that implement options from webpack-dev-server or a subset thereof.
It would be awesome if can set proxy in this plugin😁
Has anyone pr this feature?
@thgh, Would you be interested in a primitive version of the proxy feature as a start. I have it working right now, but only for the
serve({
proxy: {
api: 'http://localhost:7777'
}
}
syntax. The advanced syntax wouldn't be much more difficult to implement, but I don't have the bandwidth right now.
any update on this?
i was using @calebdwilliams's fork, but things did not quite work out when was using busboy. would love to see any implementation
FWIW, I've been using @pearofducks rollup-plugin-dev and it's been working splendidly for me -- https://github.com/pearofducks/rollup-plugin-dev
I come from webpack and this has been a great transition from WDS! This is how I use it in rollup.config.js:
plugins: [
....
// In dev mode, serve API under a proxy, so we needn't inject
// api url into the app.
!production && dev({
dirs: ['public'],
port: 3000,
proxy: { '/api/*': 'http://localhost:12345/' },
spa: true,
}),
....
]