Skip to content

Import *.js files directly in "type": "module" #290

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

Closed
alecmev opened this issue Oct 11, 2023 · 4 comments
Closed

Import *.js files directly in "type": "module" #290

alecmev opened this issue Oct 11, 2023 · 4 comments
Labels
feature request Feature request

Comments

@alecmev
Copy link

alecmev commented Oct 11, 2023

This check can be extended to also allow *.js in ESM contexts:

https://github.com/webpro/knip/blob/cc0fbc69e2aef3570ec0e888b101e57e68239fba/src/util/loader.ts#L28-L32

Why? Hitting a couple of rough edges in Jiti:

No top-level await: unjs/jiti#72
No import.meta.resolve: unjs/jiti#101

Not high priority though, all of this is work-aroundable, just documenting it.

@webpro
Copy link
Member

webpro commented Nov 13, 2023

🚀 This issue has been resolved in v2.41.1. See Release 2.41.1 for release notes.

@webpro
Copy link
Member

webpro commented Nov 13, 2023

Thanks Alec, good idea, .js modules now use native import().

@alecmev
Copy link
Author

alecmev commented Nov 28, 2023

Thank you!

@webpro
Copy link
Member

webpro commented Mar 14, 2024

Knip v5.1 introduces a new workaround: bunx --bun knip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Feature request
Projects
None yet
Development

No branches or pull requests

2 participants