webpack/webpack-dev-server

Webpack module federation breaks with multiple entrypoints

Open

#2,692 opened on Aug 3, 2020

View on GitHub
 (100 comments) (20 reactions) (0 assignees)JavaScript (7,624 stars) (1,469 forks)batch import
help wantedpriority: 3 (important)scope: webpacksemver: patchseverity: 3 (broken)type: bug

Description

This time it's @sokra who told me this is probably the place to open an issue.

  • Operating System: Windows 10
  • Node Version: 12.16.2
  • NPM Version: 6.14.4
  • webpack Version: 5.0.0-beta.22
  • webpack-dev-server Version: 3.11.0
  • Browser: Chrome 84.0.4147.105, Firefox 79.0, Edge 84.0.522.48
  • This is a bug

Code

https://github.com/codepunkt/module-federation-examples/tree/dynamic-host-remote

Expected Behavior

Using webpack-dev-server instead of webpack should still support module federation with additional content tacked onto the remoteEntry by defining it as an additional entry.

Actual Behavior

Running "yarn start" to start webpack-dev-server breaks module federation and thus breaks the app in development mode.

For Bugs; How can we reproduce the behavior?

  1. clone repository
  2. ensure you're on branch "dynamic-host-remote"
  3. run yarn on repo root
  4. go into "dynamic-host-remote" directory
  5. run yarn start in "dynamic-host-remote" directory
  6. open localhost:3001 in the browser
  7. encounter an error in the browser console that happens when executing app2/remoteEntry.js with the additional contents that were added to this entrypoint by webpack-dev-server
  8. OPTIONAL: run yarn build && yarn serve and revisit localhost:3001 to see production build working just fine.

Contributor guide