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

Add support for CommonJS Modules #76

Closed
gustavo-cunha-alves opened this issue Oct 6, 2023 · 1 comment
Closed

Add support for CommonJS Modules #76

gustavo-cunha-alves opened this issue Oct 6, 2023 · 1 comment

Comments

@gustavo-cunha-alves
Copy link

Hi!

Recently, when attempting to import the library using CommonJS as follows:

const pRetry = require('p-retry');

I received the following error:
Detailed stack trace: Error [ERR_REQUIRE_ESM]: require() of ES Module <stack-files> not supported. Instead change the require of index.js in <stack-files> to a dynamic import() which is available in all CommonJS modules.

While researching the problem, I found a possible solution in this Stack Overflow post. The solution involves making some additional configurations to add CommonJS support to the library. This could significantly enhance the library's experience for developers who use JavaScript and CommonJS.

Thanks

@sindresorhus
Copy link
Owner

https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

@sindresorhus sindresorhus closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2023
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