Closed jasnell closed 6 years ago
I thought that there was supposed to be module idempotency around this like other similar cases.
Are we even required to implement import
(the function) in Node?
Required is a strong word. If you don't provide an implementation, import('anything')
will just return a rejected promise. But it's the easiest & cleanest way to access modules from CommonJS. So it would be very nice to have.
@jkrems I'll clarify, Node has asynchronous require
and removed it - I'm absolutely convinced asynchronous imports are crucial on the client side (for lazy loading resources for example) - but I'm not sure loading modules asynchronously is even a use case Node needs to support.
I'm not saying we shouldn't, but I think that import
as a function might meet a lot of resistance in Node - and I'm wondering if we're even interested in it and what use cases loading modules asynchronously might have in Node.
I'm really unclear why import() is being discussed in this thread.
Why? This is about import() behavior, if node rejects on all import()s then it affects this.
This isn't related to import() behavior at all. The linked post in the OP uses import() in some examples, but it applies to all ways of loading a module.
I'm going to close this, but feel free to open another issue in a relevant active repository (TSC perhaps?) and include a link back to this issue if this is a subject that should receive continued attention.
@domenic led a discussion at TC-39 around ES Modules with dependency loops and failures during evaluation. Presentation is here: https://github.com/tc39/ecma262/issues/862 ... this is definitely something that we need folks here to help review and provide feedback on.