Skip to content
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

chore: hoist mf plugin to global #656

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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).

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?

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