Protocol http is not support by the default ESM loader #669
Unanswered
justin-slijkhuis
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My goal is to import components from website A in website B so I can use the same components in both websites. For technical details:
I have a single component exposed in website A. When I navigate to 'http://localhost:5173/dist/assets/remoteEntry.js', then I can see the code for the component there. In website B, when I use fetch('http://localhost:5173/dist/assets/remoteEntry.js'), then it also shows this code.
Yet when I use the code below in my vite.config.ts of website B, then it keeps giving me the error below the code snippet. Some people suggested it was caused by Windows, but moving both websites to Linux Docker containers did not help. Others suggested an outdated Node version, but I am already using the latest version of Node. Downgrading to a different version also does not help.
After doing more research, I found that the import function of ESM does not support importing HTTP or HTTPS URLs. So vite-plugin-federation isn't able to import the remoteEntry.js page. Anyone know what to do in this situation?
Before anyone asks: I am very positive that website B can reach remoteEntry.js of website A, even with my Docker setup.
Beta Was this translation helpful? Give feedback.
All reactions