Adding modules to runtime
Any script can extend the runtime module system, Live offers a utility function to expose a directory of javascript modules.
The directory structure
It is advised to create a shared folder within your project, like so:
Exposing the entire "shared" directory
Inside the shared folder create index.ts file with the following content:
Import the shared index file from the app entry point
app.tsx
That's it! Your modules are ready to be required by another plugin's web application.
Example result
Before importing from plugin-example
there are some configurations needed to be set up.
1. Configure your webpack.config.js
to treat these modules as external
webpack.config.js
to treat these modules as externalwebpack.config.js
2. Configure your pom.xml
to add explicitly show that dependency
pom.xml
to add explicitly show that dependencyNow you're set up to import modules from plugin-example
!
3. Import from plugin-example
in any module
plugin-example
in any moduleLast updated