Host and Remote Container Configuration
Host and Remote Container Configuration
In enterprise micro-frontend deployments, hardcoding remote URLs into build configuration files (webpack.config.js) introduces deployment coupling: updating a remote's CDN endpoint requires rebuilding and redeploying the host application. Dynamic host and remote container configuration enables runtime remote resolution, version negotiation, and environment-driven URL injection.
1. Dynamic Remote URL Injection Pattern
Instead of static configuration strings, resolve remote containers at runtime using dynamic script injection:
2. Dynamic Remote Component Wrapper
3. Environment-Aware Service Discovery
In production, fetch remote manifests dynamically from a centralized Service Discovery / Configuration service:
4. Shared Dependency Version Negotiation
When Host and Remote applications specify different versions of a shared package in their package.json, Module Federation applies SemVer rules:
- If versions are compatible (e.g. Host requires
^18.2.0, Remote requires^18.1.0), Webpack loads the highest compatible version. - If
singleton: trueis set and versions conflict incompatibly (e.g.17.0.0vs18.2.0), Webpack logs a console warning and uses the host's version, preventing multiple conflicting runtimes.
Practice Quiz
Cross-Application State Sharing and Event Buses
Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
Related Lessons
| Previous Lesson | Next Lesson |
|---|---|
| Micro-Frontend Architectures and Module Federation | Cross-Application State Sharing and Event Buses |
Practice Quiz
Test your understanding of this lesson with 5 questions. Each question has one correct answer.