Skip to content

module-federation/common-3rd-parties

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

new ModuleFederationPlugin({
  name: "app1",
  remotes: {
    "@module-federation/common-3rd-libs": `moduleFederationCommon_3rdLibs@https://unpkg.com/@module-federation/[email protected]/dist/browser/remote-entry.js`,
  },
  shared: { react: { singleton: true }, "react-dom": { singleton: true } },
})

Examples:

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");
});

About

Common Third party scripts provided as federated modules

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published