I have eg. 3 React widgets but for each of them I need to have separate components and node_modules. Is there a chance that in liferay 7.3.5 those 3 widgets can share the components, node modules, etc.?
Eg. React Widget 1(and 2,3) can share the 'ReusablePart' component
import React from 'react';
import ReusablePart from '../components/ReusablePart'
function ReactWidget1() {
return (
<div className="App">
<header className="App-header">
<ReusablePart />
</header>
</div>
);
}
something like
ReactSuperWidget
- components
--ReusablePart
-ReactWidgets
--ReactWidget1
--ReactWidget2
--ReactWidget3
and build them with 3 separate liferay jars (react-widget1.jar, react-widget2.jar, react-widget3.jar)
You have multiple options to include common JS code on each page, e.g.:
Which route you take likely depends on the structure of your code and preferences of control/deployment.