You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 4, 2022. It is now read-only.
Note that since the field name is `button-text`, the value is accessed as `'data-button-text'`.
77
+
78
+
### External dependencies
79
+
80
+
`externalPeerDependencies` is a tool designed to share JS dependencies across different widgets.
81
+
This module provides an example how to avoid bundling `react`, `react-dom`, and `react-intl` with
82
+
the widget's JS, while making Drupal (or any other available integrations) load the dependencies
83
+
automatically.
84
+
85
+
For each dependency you will need to:
86
+
87
+
1.[Tell Webpack to not include the library](https://github.com/js-widgets/example-widget/blob/master/craco.config.js#L32-L35) in the resulting JS file(s) for this widget.
88
+
```js
89
+
// webpack.config.js or craco.config.js
90
+
externals: {
91
+
react:'React',
92
+
'react-dom':'ReactDOM',
93
+
'react-intl':'ReactIntl',
94
+
},
95
+
// ...
96
+
```
97
+
1.[Tell the widget registry (in `widget.json`)](https://github.com/js-widgets/example-widget/blob/master/widget.json#L37-L46), and ultimately the CMS integrations where to find these libraries that were excluded.
0 commit comments