{"id":19380852,"url":"https://github.com/module-federation/automatic-vendor-federation","last_synced_at":"2025-04-23T20:31:46.891Z","repository":{"id":38174477,"uuid":"264016610","full_name":"module-federation/automatic-vendor-federation","owner":"module-federation","description":"Utility to enable automatic vendor sharing within bundles using Module Federation","archived":false,"fork":false,"pushed_at":"2024-03-24T07:05:29.000Z","size":135,"stargazers_count":76,"open_issues_count":17,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-21T22:22:54.216Z","etag":null,"topics":["federation","module","share","vendor"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/module-federation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":"ScriptedAlchemy","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-05-14T20:19:55.000Z","updated_at":"2025-02-24T12:15:17.000Z","dependencies_parsed_at":"2024-03-02T02:27:49.681Z","dependency_job_id":"cafe36f1-6c95-4cf8-b3d8-386aa688506f","html_url":"https://github.com/module-federation/automatic-vendor-federation","commit_stats":{"total_commits":35,"total_committers":7,"mean_commits":5.0,"dds":0.6571428571428571,"last_synced_commit":"d0e7cdeb30786bb136b52c2cfc508bee531f73b4"},"previous_names":["module-federation/automatic-vendor-sharing"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/module-federation%2Fautomatic-vendor-federation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/module-federation%2Fautomatic-vendor-federation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/module-federation%2Fautomatic-vendor-federation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/module-federation%2Fautomatic-vendor-federation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/module-federation","download_url":"https://codeload.github.com/module-federation/automatic-vendor-federation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250509655,"owners_count":21442469,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["federation","module","share","vendor"],"created_at":"2024-11-10T09:14:59.514Z","updated_at":"2025-04-23T20:31:46.581Z","avatar_url":"https://github.com/module-federation.png","language":"JavaScript","funding_links":["https://github.com/sponsors/ScriptedAlchemy"],"categories":[],"sub_categories":[],"readme":"# automatic-vendor-federation\n\nUtility to enable automatic vendor sharing within bundles using Module Federation\n\n## This tool will be part of Webpack 5 core: https://github.com/webpack/webpack/pull/10960\n\n# Check out our book\n| \u003ca href=\"https://module-federation.myshopify.com/products/practical-module-federation\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/module-federation/module-federation-examples/raw/master/docs/MFCover.png\" alt='Practical Module Federation Book' width=\"90%\"/\u003e\u003c/a\u003e | \u003ca href=\"https://module-federation.myshopify.com/products/practical-module-federation\" target=\"_blank\"\u003eWe will be actively updating this book over the next year as we learn more about best practices and what issues people are running into with Module Federation, as well as with every release of Webpack as it moves towards a release candidate and release. So with your one purchase you are buying a whole year of updates.\u003c/a\u003e |\n|------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\n# Install\n\n```shell script\nyarn add @module-federation/automatic-vendor-sharing -D\n```\n\n# Usage\nThere are a few arguments you can pass to the utility.\n* `exclude` : allows you to filter out any packages including part of the string.\n* `packageJson` : pass your apps `package.json`: eg: `require(\"./package.json\");`\n* `ignoreVersion`: you can ignore versions on some shared packages. This utility supports versioned dependencies, which is a problem when using React as there can only be one version on the page\n* `ignorePatchVersion` : ignore patch numbers and share dependencies based on a minor version matching. lodash-4.11 instead of lodash-4.11.7\n* `shareFrom`: choose where in package.json the utility should share from. `['dependencies','peerDependencies']`/ (default: `dependencies`)\n\n```js\nconst AutomaticVendorFederation = require(\"@module-federation/automatic-vendor-federation\");\nconst { ModuleFederationPlugin } = require(\"webpack\").container;\nconst packageJson = require(\"./package.json\");\nconst exclude = [\"babel\", \"plugin\", \"preset\", \"webpack\", \"loader\", \"serve\"];\nconst ignoreVersion = [\"react\", \"react-dom\"];\n\nmodule.export = {\n  //... rest of your config\n  plugins: [\n    new ModuleFederationPlugin({\n      name: \"app2\",\n      library: { type: \"var\", name: \"app2\" },\n      filename: \"remoteEntry.js\",\n      remotes: {\n        app1: \"app1\",\n      },\n      exposes: {\n        Button: \"./src/Button\",\n      },\n      shared: AutomaticVendorFederation({\n        exclude,\n        ignoreVersion,\n        packageJson,\n        shareFrom: [\"dependencies\", \"peerDependencies\"],\n        ignorePatchVersion: true,\n      }),\n    }),\n  ],\n};\n```\n\n\u003cimg src=\"https://ssl.google-analytics.com/collect?v=1\u0026t=event\u0026ec=email\u0026ea=open\u0026t=event\u0026tid=UA-120967034-1\u0026z=1589682154\u0026cid=ae045149-9d17-0367-bbb0-11c41d92b411\u0026dt=ModuleFederation\u0026dp=/email/AutoVendorFederation\"\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodule-federation%2Fautomatic-vendor-federation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmodule-federation%2Fautomatic-vendor-federation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodule-federation%2Fautomatic-vendor-federation/lists"}