1.0.1 • Published 2 years ago
@chang-ch/mfe-proxy v1.0.1
npm i --save-dev mfe-proxyThis is a proxy server that listens to webpack dev servers published with bonjour and proxies requests to the local/remote servers.
The server will proxy requests from /{module name}/... to either the local source or the remote source specified.
- Create a config file
remotes:
component1:
remoteUrl: remote.com # remote URL to get module from
moduleName: component1 # name of remote module
bonjourName: webpack-component1 # name of bonjour server- start
mfe-proxy:
> mfe-proxyA config panel will be available on the root url of the port (e.g. localhost:8080)
Change module sources as desired in the config panel
localwill try to proxy requests from/{module name}/...tolocalhost:port/...of the local dev server if available. If local dev server is unavailable requests are proxied to the remote url in the configremotewill proxy requests from/{module name}/...to{remoteUrl}/....