{"id":19290529,"url":"https://github.com/jacob-ebey/webpack-module-federation-node-esm-example","last_synced_at":"2026-03-27T02:45:54.611Z","repository":{"id":228262945,"uuid":"683223181","full_name":"jacob-ebey/webpack-module-federation-node-esm-example","owner":"jacob-ebey","description":"This project serves as a straightforward and illustrative demonstration of how two Node.js processes can collaborate by federating modules through HTTP dynamic imports using Webpack. The main goal is to showcase how you can achieve module sharing and dynamic loading in a Node.js environment.","archived":false,"fork":false,"pushed_at":"2023-08-25T22:45:31.000Z","size":21,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-01T20:11:13.355Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jacob-ebey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-08-25T22:45:15.000Z","updated_at":"2024-04-05T07:53:55.000Z","dependencies_parsed_at":"2024-03-17T23:22:48.149Z","dependency_job_id":"5a93e0d3-cacf-4a1a-be50-f99660c3ec3d","html_url":"https://github.com/jacob-ebey/webpack-module-federation-node-esm-example","commit_stats":null,"previous_names":["jacob-ebey/webpack-module-federation-node-esm-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacob-ebey%2Fwebpack-module-federation-node-esm-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacob-ebey%2Fwebpack-module-federation-node-esm-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacob-ebey%2Fwebpack-module-federation-node-esm-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacob-ebey%2Fwebpack-module-federation-node-esm-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jacob-ebey","download_url":"https://codeload.github.com/jacob-ebey/webpack-module-federation-node-esm-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250175096,"owners_count":21387138,"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":[],"created_at":"2024-11-09T22:19:34.100Z","updated_at":"2026-03-27T02:45:54.560Z","avatar_url":"https://github.com/jacob-ebey.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webpack Module Federation Node ESM Example\n\nThis project serves as a straightforward and illustrative demonstration of how\ntwo Node.js processes can collaborate by federating modules through HTTP dynamic\nimports using Webpack. The main goal is to showcase how you can achieve module\nsharing and dynamic loading in a Node.js environment.\n\n## Key Features\n\n- Utilizes the `--experimental-network-imports` flag to effectively import\n  federated chunks over HTTP.\n- Leverages Webpack's experimental features:\n  - `experiments.outputModule`\n  - `externalsType: \"module\"`\n  - `output.chunkFormat: \"module\"`\n  - `output.chunkLoading: \"import\"`\n\n## Getting Started\n\nFollow these steps to set up and run the project on your local machine.\n\n### Installation\n\nTo begin, install the required dependencies using the following command:\n\n```sh\npnpm i\n```\n\n### Build\n\nNext, trigger the build process with the subsequent command:\n\n```sh\npnpm build\n```\n\n### Running\n\nCommence the execution of the project by running:\n\n```sh\npnpm start\n```\n\nThis will initiate the Node.js processes, allowing you to witness the module\nfederation and HTTP dynamic imports in action.\n\n## Explanation\n\nThe project employs cutting-edge features from Webpack and Node.js to enable\nseamless module sharing and dynamic loading. By utilizing the\n`--experimental-network-imports` flag, modules are fetched over HTTP, thereby\nfacilitating effective module federation between two Node.js processes. This is\naccomplished through Webpack's advanced settings such as\n`experiments.outputModule`, `externalsType: \"module\"`,\n`output.chunkFormat: \"module\"`, and `output.chunkLoading: \"import\"`. These\nsettings collectively enable the generation of ESM output, ensuring optimal\ndynamic imports for efficient chunk loading.\n\nThrough these steps, the project effectively demonstrates how to create an\nenvironment where Node.js processes can collaborate and share modules\neffortlessly.\n\n## Further Steps\n\nThis example serves as a foundation for understanding module federation and\ndynamic imports. To explore more complex scenarios and integrate these concepts\ninto your own projects, consider the following steps:\n\n- **Deep Dive**: Study the Webpack documentation to understand the full spectrum\n  of possibilities with module federation and dynamic imports.\n\n- **Real-world Integration**: Apply the knowledge gained from this example to\n  integrate module federation into your larger projects, enabling efficient code\n  sharing and dynamic loading.\n\n- **Optimization**: Experiment with different settings and configurations to\n  optimize performance and loading times in scenarios involving multiple\n  federated modules.\n\n- **Error Handling**: Implement robust error-handling mechanisms to ensure\n  graceful degradation in case of failed module imports or network issues.\n\nBy delving deeper into these areas, you can unlock the full potential of module\nfederation and dynamic imports in your Node.js projects.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacob-ebey%2Fwebpack-module-federation-node-esm-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacob-ebey%2Fwebpack-module-federation-node-esm-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacob-ebey%2Fwebpack-module-federation-node-esm-example/lists"}