[Feature]: Return exports from IIFE independently of library type #12104
Unanswered
redstonekasi
asked this question in
Q&A
Replies: 1 comment
-
|
I have looked into this a bit more and it seems this can be quite nicely implemented in a plugin, unfortunately it seems that SWC has a bug that makes |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
What problem does this feature solve?
Sometimes it is useful to return exports directly from the IIFE even if they aren't immediately consumed by anything. An
evalfor example, could then be used.Currently there is no way to achieve this apart from using one of the library types that use
ExportPropertyLibraryPlugin, such asamdand subsequently modifying the output asset.What does the proposed API of configuration look like?
I propose adding a configuration that adds
ExportPropertyLibraryPluginto the configuration in addition to enabling theRETURN_EXPORTS_FROM_RUNTIMEruntime requirement.This could be exposed via a new
returnlibrary type, for example.I am not aware of a webpack equivalent for this; it is, however, trivial to implement yourself, in contrast to Rspack where such a thing is not easily accessible from JS.
Beta Was this translation helpful? Give feedback.
All reactions