-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Add --import <module>
flag for pre-loading ESM modules
#40110
Comments
@nodejs/modules |
Would love and endorse this (likely under |
Agreed, |
--module <module>
flag for pre-loading ESM modules--import <module>
flag for pre-loading ESM modules
There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment. For more information on how the project manages feature requests, please consult the feature request management document. |
bump |
@nodejs/loaders if I was to find someone to work on this does this feature have reasonable consensus? |
The issue has been open for almost a year with no objections in response, and even some support for it; I'd say it's reasonable to assume it has consensus, it only need someone to do the work. Note that now that Node.js supports chaining loaders, using |
@MoLow is this something you'd be interested in working on? |
Id like to yes :) |
I second what @aduh95 wrote. I don't think |
Not sure if this was discussed already somewhere but I haven't found it:
|
I don't think it was discussed already. Maybe it's worth a
That's what I'd expect. |
After. Loaders should always be first, before
If both are used together, you mean? I don’t know. I would think that all packages defined by either are loaded in the order defined, like
Yes. |
Why do we need two flags exactly? It seems to me that it would be much simpler to re-use the |
I'm not sure I follow. The loader flag expects a file with particular exports, like an exported |
It would gladly accept a file with no exports though. The only use case for having a separate flag would be if one wanted to run a flag that exports whose name coincide with a loader, but not as a loader. That seems very unlikely, and quite easy to workaround anyway. |
Because I don't think code in |
That |
How about to start with implementing |
👍🏻 I am working on this and hope to ship a initial PR this/next week |
PR-URL: nodejs#43942 Fixes: nodejs#40110 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
The responsibility of the preloaded modules are confusing. Now the esm module loader has its own file. When node will support esm module preloading with `--import` flag it will be even better because it does not change the module loader for the main file -- cf: nodejs/node#40110
PR-URL: nodejs#43942 Fixes: nodejs#40110 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
@bpstrngr please open a new issue. |
Is your feature request related to a problem? Please describe.
-r
can be used only on CommonJS modules, as documented here. Pre-loading an.mjs
or an ESM module package is currently not possible.Describe the solution you'd like
Either expansion of
-r
to support ESM modules (might break some people, not sure the scope of those changes) or the inclusion of a--module, -m <module>
flag. Neither the long nor short arguments appear to exist in either Node or v8 according to the above docs (correct me if I'm wrong).Describe alternatives you've considered
None, I perceive this to be a hole in the CLI option set.
The text was updated successfully, but these errors were encountered: