nodejs / CTC

Node.js Core Technical Committee & Collaborators
80 stars 27 forks source link

TC-39 Discussion: Modules with failed evaluation #132

Closed jasnell closed 6 years ago

jasnell commented 7 years ago

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

Fishrock123 commented 7 years ago

I thought that there was supposed to be module idempotency around this like other similar cases.

benjamingr commented 7 years ago

Are we even required to implement import (the function) in Node?

jkrems commented 7 years ago

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.

benjamingr commented 7 years ago

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

domenic commented 7 years ago

I'm really unclear why import() is being discussed in this thread.

benjamingr commented 7 years ago

Why? This is about import() behavior, if node rejects on all import()s then it affects this.

domenic commented 7 years ago

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.

Trott commented 6 years ago

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.