It's a small library that allows big things. Its main purpose is to enable building large-scale application with lazy-loaded modules based on either React or Angular.
react-module-container
Add react-module-container
npm module as your dependency.
npm install --save react-module-container
Create a manifest.js
file that describe your future lazy module. It can be either Angular or React lazy module.
class NgMainApp extends AngularLazyComponent {
constructor(props) {
super(props, {
files: [
`${props.topology.staticsBaseUrl}angular-client.css`,
`${props.topology.staticsBaseUrl}angular-client.bundle.js`
],
module: 'myApp',
component: 'main-app',
unloadStylesOnDestroy: true
});
}
}
ModuleRegistry.registerComponent('angular.main', () => NgMainApp);
Load manifest.js
file in the index.html
of your hosting application.
<script src="https://github.com/wix-incubator/react-module-container/raw/master/<path-to-your-manifest-file>/manifest.js"></script>
Instantiate your lazy component using ModuleRegistry
and render it inside hosting application.
const AngularComponent = ModuleRegistry.component('angular.main');
class App extends React.Component {
render() {
return (
<AngularComponent topology={{
staticsBaseUrl: 'http://localhost:3200'
}} />
);
}
}
git clone git@github.com:wix/react-module-container.git
cd react-module-container
npm install
npm start
http://localhost:3200
The MIT License.
See LICENSE