Skip to content

Conversation

@2heal1
Copy link
Member

@2heal1 2heal1 commented Jan 7, 2025

Summary

hoist mf plugin to global

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@netlify
Copy link

netlify bot commented Jan 7, 2025

Deploy Preview for rslib ready!

Name Link
🔨 Latest commit f2ef4a2
🔍 Latest deploy log https://app.netlify.com/sites/rslib/deploys/677ce68a4922e50008f41c6d
😎 Deploy Preview https://deploy-preview-656--rslib.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@fi3ework fi3ework left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change for functionality reason, or just polish code style?

@2heal1
Copy link
Member Author

2heal1 commented Jan 7, 2025

Is this change for functionality reason, or just polish code style?

functionality reason, we may inject variables for runtime api in the future , so the plugin need to be hoisted as global plugin .

If not , we can only affect the mf type asset , the other assets will be crashed without injecting our expected variables.

@fi3ework
Copy link
Member

fi3ework commented Jan 7, 2025

If not , we can only affect the mf type asset , the other assets will be crashed without injecting our expected variables.

So if there's a lib config which is a pure ESM or CJS output without any MF stuff, how could it bail out from runtime injecting of the plugin?

I guess something like below?

[
  { plugins: [mfPlugin]}, // MF related lib
  { plugins: [mfPlugin]}, // MF related lib
  { plugins: []},         // non-MF related lib
]

@Timeless0911
Copy link
Contributor

What if there are multiple objects in lib array, global plugins will take effect for them all. How to use different options to distinguish them?

And we have supported npx rslib mf-dev --lib mf1 to choose one lib of mf format, is this feature not needed?

@fi3ework
Copy link
Member

fi3ework commented Jan 13, 2025

@2heal1 Do we need an update?

@2heal1
Copy link
Member Author

2heal1 commented Mar 7, 2025

It only affect format: 'mf' by checking the library.type https://github.com/module-federation/core/blob/main/packages/rsbuild-plugin/src/cli/index.ts#L35

@Timeless0911
Copy link
Contributor

What if there are two build configurations with format mf in the lib array, does the global mf plugin mean they will use the same plugin configuration?

@2heal1
Copy link
Member Author

2heal1 commented Mar 7, 2025

Ahh yes, i forget this scene. The pr should be closed, i need to think this scene, especially i want to add ssr output as well

@2heal1 2heal1 closed this Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants