https://github.com/av/sample-widget-bundle
This repo holds a sample widget bundle
https://github.com/av/sample-widget-bundle
Last synced: 9 months ago
JSON representation
This repo holds a sample widget bundle
- Host: GitHub
- URL: https://github.com/av/sample-widget-bundle
- Owner: av
- License: mit
- Created: 2021-08-11T08:19:06.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-08-11T09:16:36.000Z (over 4 years ago)
- Last Synced: 2025-02-14T11:33:52.887Z (11 months ago)
- Language: JavaScript
- Size: 87.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sample-widget-bundle
This repo holds a sample widget bundle. It's implemented with Parcel (v1).
#### Widget Registration
Bundle root imports a `CustomWidget.js` component, which uses host application Browser API to register the widget instance:
```javascript
PremiumPortal.Dashboard.registerWidget(CustomWidget, { ... });
```
#### Dependency Sharing
Custom Widgets have to use the same exact React/ReactDOM version as the host application. This is achieved by using `parcel-plugin-externals`:
```javascript
// package.json
{
// ...
"externals": {
"react": "window.PremiumPortal.React",
"react-dom": "window.PremiumPortal.ReactDOM"
}
// ...
}
```