{"id":18907725,"url":"https://github.com/waldronmatt/dynamic-container-path-webpack-plugin","last_synced_at":"2025-10-25T19:36:46.817Z","repository":{"id":42401226,"uuid":"356675182","full_name":"waldronmatt/dynamic-container-path-webpack-plugin","owner":"waldronmatt","description":"Change 'publicPath' at run time rather than build time for dynamic module federated containers.","archived":false,"fork":false,"pushed_at":"2022-04-06T23:05:22.000Z","size":26,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-28T01:28:12.922Z","etag":null,"topics":["containers","dynamic","module-federation","plugin","publicpath","webpack"],"latest_commit_sha":null,"homepage":"","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/waldronmatt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-10T19:27:42.000Z","updated_at":"2024-05-06T09:15:07.000Z","dependencies_parsed_at":"2022-08-28T21:41:25.121Z","dependency_job_id":null,"html_url":"https://github.com/waldronmatt/dynamic-container-path-webpack-plugin","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/waldronmatt/dynamic-container-path-webpack-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waldronmatt%2Fdynamic-container-path-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waldronmatt%2Fdynamic-container-path-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waldronmatt%2Fdynamic-container-path-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waldronmatt%2Fdynamic-container-path-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waldronmatt","download_url":"https://codeload.github.com/waldronmatt/dynamic-container-path-webpack-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waldronmatt%2Fdynamic-container-path-webpack-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281012040,"owners_count":26429437,"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","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["containers","dynamic","module-federation","plugin","publicpath","webpack"],"created_at":"2024-11-08T09:22:56.533Z","updated_at":"2025-10-25T19:36:46.745Z","avatar_url":"https://github.com/waldronmatt.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://avatars.githubusercontent.com/u/61727377?s=200\u0026amp;v=4\"\u003e\u003cimg width=\"200\" height=\"200\" src=\"https://avatars.githubusercontent.com/u/61727377?s=200\u0026amp;v=4\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://webpack.js.org/assets/icon-square-big.svg\"\u003e\u003cimg width=\"200\" height=\"200\" src=\"https://webpack.js.org/assets/icon-square-big.svg\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n# dynamic-container-path-webpack-plugin\n\n\u003e A `publicPath` mutator webpack plugin for module federation.\n\n## About plugin\n\nChange `publicPath` at run time rather than build time for dynamic module federated containers.\n\nThis should be used in conjunction with module federation's [exposed methods for initializing remote containers dynamically](https://webpack.js.org/concepts/module-federation/#dynamic-remote-containers) instead of using the `remotes` parameter for static paths.\n\n## Install\n\n```bash\nnpm i -D dynamic-container-path-webpack-plugin\n```\n\n## Usage\n\n`webpack.config.js`\n\n```js\nconst { ModuleFederationPlugin } = require('webpack').container;\nconst DynamicContainerPathPlugin = require('dynamic-container-path-webpack-plugin');\nconst setPublicPath = require('dynamic-container-path-webpack-plugin/set-path');\n\nmodule.exports = {\n  entry: {\n    Host: ['./app.js'],\n  },\n  output: {\n    // this will be changed later by 'DynamicContainerPathPlugin' at runtime\n    publicPath: '/',\n  },\n  plugins: [\n    new ModuleFederationPlugin({\n      // ...\n    }),\n    new DynamicContainerPathPlugin({\n      iife: setPublicPath,\n      entry: 'Host',\n    }),\n  ],\n};\n```\n\n## Options\n\n### `iife`\n\n- Type: `function`\n\nAn immediately invoked function expression to get `publicPath` at runtime.\n\n### `entry`\n\n- Type: `string`\n\nThe entry point name of the application.\n\n**Note**: You have access to the **entry** and **chunk** via your **iife**:\n\n```js\nfunction determinePublicPath(entry, chunk) {\n  if (chunk !== \"Host\") {\n    return `/something/${entry}/`;\n  }\n\n  return \"/\";\n}\n\nnew DynamicContainerPathPlugin({\n  iife: determinePublicPath,\n  entry: 'Host',\n}),\n```\n\n## Getting Started\n\nSee [Tutorial - A Guide to Module Federation for Enterprise](https://dev.to/waldronmatt/tutorial-a-guide-to-module-federation-for-enterprise-n5) for more information and to learn how this webpack plugin works.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaldronmatt%2Fdynamic-container-path-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaldronmatt%2Fdynamic-container-path-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaldronmatt%2Fdynamic-container-path-webpack-plugin/lists"}