1.0.1 • Published 11 months ago
@chang-ch/mfe-proxy v1.0.1
npm i --save-dev mfe-proxy
This 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-proxy
A 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
local
will 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 configremote
will proxy requests from/{module name}/...
to{remoteUrl}/...
.