Replies: 3 comments 6 replies
-
how did you start the server on :3000 |
Beta Was this translation helpful? Give feedback.
-
I have encountered the same issue, but with tanstack router. When module federation is not enabled, the script tag in the generated html is something like this.
When module federation is enabled (regardless of config), the script tag in the generated html becomes this.
Notice the missing leading slash / in the later src attribute. This causes the browser to use the full url path when fetching the js files from the server. When the url is not the basepath, e.g. localhost:3000/abc, the html will be served even though the browser requested the js file. This can be observed in the network tab in the browser. Please check your browser's network tab to see if you can also observe similar behaviour. I can get around this issue by building the project first. Then modify the generated html manually to add back the leading slash and use preview. But obviously this means I cannot use dev mode. |
Beta Was this translation helpful? Give feedback.
-
Found a related issue in module-federation-examples, it seems that adding publicPath: '/' in HtmlPlugin is a general solution to the current problem. |
Beta Was this translation helpful? Give feedback.
-
There are any config for nested routes for react-router-dom?
I have a route like that
localhost:3000/myapp/other-page
, it works normal when a click to navigate, but when I reload the page I get an error;My config:
Beta Was this translation helpful? Give feedback.
All reactions