https://github.com/module-federation/common-3rd-parties
Common Third party scripts provided as federated modules
https://github.com/module-federation/common-3rd-parties
Last synced: 4 months ago
JSON representation
Common Third party scripts provided as federated modules
- Host: GitHub
- URL: https://github.com/module-federation/common-3rd-parties
- Owner: module-federation
- License: gpl-3.0
- Created: 2021-03-01T02:59:57.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T05:57:11.000Z (over 2 years ago)
- Last Synced: 2025-09-30T18:34:06.299Z (9 months ago)
- Language: JavaScript
- Size: 61.5 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# common-3rd-parties
Common Third party scripts provided as federated modules
Allows for importing of third parties via module federation
This is shipped to unpkg and can be consumed at the latest version
https://unpkg.com/browse/@module-federation/common-3rd-libs/dist/browser/
## Configuring the consumer
```js
new ModuleFederationPlugin({
name: "app1",
remotes: {
"@module-federation/common-3rd-libs": `moduleFederationCommon_3rdLibs@https://unpkg.com/@module-federation/common-3rd-libs@1.0.4/dist/browser/remote-entry.js`,
},
shared: { react: { singleton: true }, "react-dom": { singleton: true } },
})
```
## Examples:
```js
import("@module-federation/common-3rd-libs/google-analytics").then((ga) => {
ga("create", "UA-XXXXX-Y", "auto");
ga("send", "pageview");
});
import("@module-federation/common-3rd-libs/facebook").then((fbq) => {
console.log(fbq);
fbq("init", "12341234");
fbq("track", "PageView");
});
import("@module-federation/common-3rd-libs/bing").then((UET) => {
console.log(UET);
var o = { ti: "TAG_ID_HERE" };
window.uetq = new UET(o);
window.uetq.push("pageLoad");
});
```