-
-
Notifications
You must be signed in to change notification settings - Fork 12
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 #27
Comments
Sure, but only native ESM. I don't want any build step. You need to target Node.js 12. You can see how I recently did it here: sindresorhus/quick-lru@a408ce9 |
Thanks. I don't see a clear way for Karma to be used with ESM outside of an old Karma ESM package which is recommending Web Test Runner. Should I switch to that test runner? |
Sure |
Hmmm... In order to preserve the detection and dynamic registration of your "shortcut" capabilities, I think the API would need to change to support the asynchronous nature of the dynamic native ESM imports, i.e., one would have to import an export function and await its result in order to use the Observable. Top-level await might be usable, but would require Node 14+ (and browser support is currently very limited: https://caniuse.com/mdn-javascript_operators_await_top_level ). Alternatively, the dynamic detection could be dropped in favor of requiring a specific implementation. |
What problems does making this package ESM solve? Because it sounds like converting it to ESM will cause more problems than it solves. ESM can import CommonJS. |
I like being able to make direct imports without a build step for browser (or polyglot) environments, but maybe it is just best to wait (or I could just make a specific fork). Will close for now then. Thanks! |
I'd like to keep this open so it's not forgotten. There's some useful info here. I'll circle back to this issue later this year. |
Open to an ESM PR, for native ESM and/or Rollup?
The text was updated successfully, but these errors were encountered: