question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ModuleFederationPlugin load chunks only from root directory

See original GitHub issue

Feature request

I don’t know if you considere this as a bug or a feature. I used the ModuleFederationPlugin, but places the remoteEntry.js in some subfolders on my express-server, so the url to the file is something like:

http://localhost/sub/folder/remoteEntry.js

I want to load remotes dynamically like in: https://github.com/module-federation/module-federation-examples/tree/7930cd5452555928801e1550f836ffe3d438a66b/advanced-api/dynamic-remotes

When I load the remoteEntry from the url, I got the following error: ChunkLoadError: Loading chunk 517 failed., because webpack tries to load it from the following url:

http://localhost:8000/517.bundle.js instead of http://localhost:8000/sub/folder/517.bundle.js

What is the expected behavior? Webpack should load the chunk from

http://localhost:8000/sub/folder/517.bundle.js

What is motivation or use case for adding/changing the behavior? Javascript-files often placed in subfolder to keep the root directory clean.

How should this be implemented in your opinion? There could be an option in the ModuleFederationPluginConfiguration to set the path.

Are you willing to work on this yourself? maybe

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
oschadecommented, Dec 21, 2020

Thank you, “publicPath” was the option I’m looking for!

0reactions
alexander-akaitcommented, Dec 21, 2020

You have publicPath, if you need help please provide reproducible example, otherwise nobody can help you

Read more comments on GitHub >

github_iconTop Results From Across the Web

ModuleFederationPlugin - webpack
This syntax allows you to share libraries with package name only. This approach is good for prototyping, but it will not allow you...
Read more >
Micro-frontends: Module Federation with WebPack 5
Is there a solution to this problem? There is, there are strategies to break that main.js file into chunks of smaller files in...
Read more >
Webpack module federation is not working with eager shared ...
It seems like the main reason of why it failed initially was that remoteEntry.js file was loaded after the code that actually runs...
Read more >
Tutorial - A Guide to Module Federation for Enterprise
load -component.js is code directly lifted from Webpack ... FormApp and now we're able to load it successfully using only the relative path...
Read more >
Module Federation Series Part 1: A Little in-depth
Since module federation is relatively new, for now, most blogs cover only the ... in angular.json/webpack so we can clearly see the names...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found