I'm using React JS + webpack. General case that I need to resolve is to dynamically load React components that were not bundled with main application. Kind of pluggable components that can be developed independently from main app and then loaded by application dynamically, without rebuilding whole app.
Particular case is below.
I have two completely separated modules (i.e. built using different package.json and webpack.config.js):
- The
MainApp - Some
Component
I need to implement following behaviour:
- Page with
MainApploaded and initialized. MainAppdynamicaly lookup for url of .js file that containsComponent(e.g. by making GET request to web-server).MainApploads .js file withComponentand include it to page as<script>MainAppuses loadedComponentwhile rendering.
Is such use-case possible in react js + webpack?