koltyakov / sp-rest-proxy

🌐 SharePoint API Proxy for local development
MIT License
170 stars 43 forks source link

Vite support #125

Closed rquanx closed 3 years ago

rquanx commented 3 years ago

How can i add this proxy into Vite

koltyakov commented 3 years ago

Had no idea what is Vite. Looks like Next.js but for Vue.

Please check this. You need to route /_api to sp-rest-proxy server.

Please note, this is only for the dev, not prod runtime.

rquanx commented 3 years ago

I tried to write a plugin for Vite and started it in the buildStart hook, but there was a problem that Vite would restart the server after the modification and the proxy would be created repeatedly to generate listen EADDRINUSE error.I added the judgment of whether the port is free, but if I save it quickly modify the file,There will still throw exceptions.

normal image

quick edit image

rquanx commented 3 years ago

publish rollup-plugin-sp-rest-proxy for dev

koltyakov commented 3 years ago

Thanks! Going to link your plugin in README.