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

Feature Request: CommonJS Support (Drop ESM / Babel Requirement) #18

Closed
jmealo opened this issue Feb 18, 2021 · 4 comments
Closed

Feature Request: CommonJS Support (Drop ESM / Babel Requirement) #18

jmealo opened this issue Feb 18, 2021 · 4 comments

Comments

@jmealo
Copy link

jmealo commented Feb 18, 2021

Hello!

I'm a huge fan of your work and use got everywhere I go.

Use case: I don't transpile my code or use typescript; I make use require-in-the-middle and cannot easily switch my type in package.json to module nor change all of my require to import.

I'm not seeing a way to use this module in Node 14 unless my project is 100% ESM and/or using Babel.

Am I missing something?

Thanks for your great work!

@sindresorhus
Copy link
Owner

Then I suggest just staying on the older version. I don't intend to add back CommonJS compatibility. You should prepare for ESM though, as at the end of April, me and many other maintainers intend to move all their packages to ESM: https://blog.sindresorhus.com/get-ready-for-esm-aa53530b3f77

@jmealo
Copy link
Author

jmealo commented Feb 18, 2021

@sindresorhus: ahhh, that makes sense! Thank you for sharing.

@sindresorhus
Copy link
Owner

You could also use import(…) to dynamically import the ESM module into CommonJS. That works.

@jmealo
Copy link
Author

jmealo commented Feb 18, 2021

@sindresorhus: I really appreciate you taking the time to find a workaround given your stance on the subject.

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

2 participants