NEW UPDATES: changing direction
We managed to make this RFC works but we feel it adds complexity to the current solution instead simplifying the process.
The new approach we tried includes the new @theforeman/vendor
with the following changes:
@theforeman/vendor
-
@theforeman/vendor
will build itself using webpack- It will produce
dist/foreman-vendor.bundle.js[.gzip]
anddist/foreman-vendor.bundle.css[.gzip]
- It will use the
window
object to share modules with core and plugins (example:window.__FOREMAN_VENDOR_REACT__
)
- It will produce
-
@theforeman/vendor
will have its own lifecycle (build, versioning, deploy to npm/rpm with the dist files)
@theforeman/vendor source
@theforeman/vendor in npm (version: 0.1.0-beta.1)
Foreman build
- Will use
@theforeman/vendor
dependency from npm/rpm/source - Will use webpack.config where externals are
@theforeman/vendor/webpack.externals
This will ensure webpack will replace thosenode_modules
with thewindow
object. - Make sure we serve
foreman-vendor.bundle.[js,css]
Foreman branch that uses the new vendor
Diff with develop
- To make it work you will need to build the dist and copy it to the public folder, I am working to fix it.
@ekohl Is currently testing it and working on the packaging side of it and will update soon.