tc39 / proposal-source-phase-imports

Proposal to enable importing modules at the source phase
https://tc39.es/proposal-source-phase-imports/
MIT License
132 stars 8 forks source link

Reflect string versus boolean #26

Closed guybedford closed 1 year ago

guybedford commented 2 years ago

There has been some discussion about whether we should use a string reflection type in dynamic import or rather have a import reflection specific boolean.

Currently we support:

const mod = await import('./mod.js', { reflect: 'module' });

But the alternative would be support:

const mod = await import('./mod.js', { module: true })

and remove any reference to the reflect key or guidance for how other specifications should interact with it. I'm personally open to whatever works best here.

ljharb commented 2 years ago

I think if the word “reflect” appears anywhere, it needs to appear everywhere - meaning, dynamic and static import syntax need to use the same words.

eemeli commented 1 year ago

I'm not really sure about using "reflect" in this context, as the module isn't necessarily instantiated here at all, and therefore there isn't a thing that is being "reflected".