feat: add rspack support#285
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #285 +/- ##
=======================================
Coverage 30.70% 30.70%
=======================================
Files 75 75
Lines 1964 1964
Branches 349 349
=======================================
Hits 603 603
Misses 1332 1332
Partials 29 29 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
fa0693a to
848e204
Compare
|
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
0a0240c to
d6563bb
Compare
cb87d63 to
783a99d
Compare
5a7a328 to
ee2b5e5
Compare
f3d26e8 to
08ac3d0
Compare
be1c687 to
658cd94
Compare
28fc49e to
19b6f81
Compare
| const { | ||
| ModuleFederationPlugin = compiler.webpack.container.ModuleFederationPlugin, | ||
| ModuleFederationPlugin = isRspack | ||
| ? (compiler as any).rspack.container.ModuleFederationPluginV1 |
There was a problem hiding this comment.
Unsafe cast to any - no guard if rspack structure changes. Use optional chaining or check existence.
const {
ModuleFederationPlugin = isRspack
? compiler.rspack?.container?.ModuleFederationPluginV1
: compiler.webpack.container.ModuleFederationPlugin,
ContainerPlugin = compiler.webpack.container.ContainerPlugin,
} = moduleFederationSettings.pluginOverride ?? {};
if (!ModuleFederationPlugin) {
throw new Error(
`${isRspack ? 'rspack' : 'webpack'}.container.ModuleFederationPlugin${isRspack ? 'V1' : ''} not found`
);
}There was a problem hiding this comment.
The guard is const isRspack = 'rspack' in compiler;. We can be pretty certain that api will be stable: https://rspack.rs/plugins/webpack/module-federation-plugin-v1
Any cast is pragmatic - rspack and webpack types are structurally similar but incompatible.
|
@charlesmulder: changing LGTM is restricted to collaborators DetailsIn response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: charlesmulder, logonoff The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@logonoff: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
TheRealJon
left a comment
There was a problem hiding this comment.
I pulled this down and ran the test script with no issues, so with the caveat that I'm not very knowledgable when it comes to this repo or rspack...
/lgtm
/verified by @TheRealJon
|
@TheRealJon: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
not needed for merging /remove-label verified |
Turns out rspack was not working for DynamicRemotePlugin due to a bug upstream: web-infra-dev/rspack#14277
The bug is fixed in 2.0.7. The only remaining compatibility mismatch is that webpack's
ModuleFederationPluginis renamed toModuleFederationPluginV1in rspack.This PR adds detection for rspack and changes the ModuleFederationPlugin implementation to use
ModuleFederationPluginV1, as expected