Skip to content
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

ESM dynamic import via CommonJS #34775

Closed
ghost opened this issue Aug 14, 2020 · 2 comments
Closed

ESM dynamic import via CommonJS #34775

ghost opened this issue Aug 14, 2020 · 2 comments

Comments

@ghost
Copy link

ghost commented Aug 14, 2020

Is your feature request related to a problem? Please describe.
A command implemented in CommonJS needs to be able to load an ESM dynamically and synchronously, without being re-implemented as an ESM. See Problem with ESM modules in the knex package.

Describe the solution you'd like

let result = esm.importSync(path);

Describe alternatives you've considered
None.

@aduh95
Copy link
Contributor

aduh95 commented Aug 14, 2020

Hey, I think this feature is related to #30891. The TL;DR of the discussion is that may not be possible at all:

  • Node.js follows the ECMAScript spec, which describes an async only resolution import mechanism.
  • ESM may contain top-level await, what would result be assigned to in which case?

@ghost
Copy link
Author

ghost commented Aug 14, 2020

I see, then I'm out of luck with knex.

@ghost ghost closed this as completed Aug 14, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant