-
-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Module Federation library type:'module' #6272
Comments
Already supported
What problem have you encountered? Would you provide a minimal reproduce? |
Hello @k4rl1, sorry we can't investigate the problem further without reproduction demo, please provide a repro demo by forking rspack-repro, or provide a minimal GitHub repository by yourself. Issues labeled by |
Will post a demo today |
Here is the demo: https://github.com/k4rl1/rspack-repro-mf-module-demo Adding:
AND like it is in the webpack config which is necessary to get it working in webpack does not do anything in the rspack config. |
Have you tried using the same configuration in rspack? It should work if you also add |
Yes, this is what I mentioned above. It does not work in the rspack config but it works fine in webpack which is the reason a opened this issue. |
I see.. Rspack didn't extract the entry module out of the iife #6402, which cause the parsing error above, we will fix it in the next few days, thanks for report this and the reproduction you provided |
Great to hear, thanks for the effort you put into it :) I will happily test it when it's done. |
Since the issue was labeled with |
Could you try the latest rsbuild, and add |
Ah thank you was not aware that it works like that. Thanks for your help :) Works fine now. |
When I use
moduleFederation: { options: { name: 'template-rspack-react', library: { type: 'module' }, ...
when I build the application with 'rsbuild build' I get
JavaScript parsing error: 'import', and 'export' cannot be used outside of module code ╭─[4498:1] 4498 │ var __webpack_exports__ = __webpack_require__("581");var __webpack_exports__get = __webpack_exports__.get; 4499 │ var __webpack_exports__init = __webpack_exports__.init; 4500 │ export { __webpack_exports__get as get, __webpack_exports__init as init }; · ────── 4501 │ 4502 │ })()
which is in my opinion related to the webpack config property environment: {module: true} which does not work with rspack but works fine with webpack.
module.exports = { output: { environment: { module: true }, },
https://webpack.js.org/configuration/output/#outputenvironment
Thanks!
The text was updated successfully, but these errors were encountered: