JustinBeckwith / retry-axios

🦖 A super flexible interceptor for Axios that makes it easy to retry requests.
Apache License 2.0
487 stars 62 forks source link

Add support for commonjs module resolution #243

Closed seidelmartin closed 11 months ago

seidelmartin commented 11 months ago

Currently, this module is not importable in NodeJS applications that are using commonjs module resolution. In order to support them I've added a separate tsconfig file that builds not only ecmascript module but also commonjs module. The steps taken to support both approaches are described in https://www.sensedeep.com/blog/posts/2021/how-to-create-single-source-npm-module.html. On top of that, I've also changed tests so they don't require to be built. I've added ts-node that can be run together with mocha and tests can be run immediately.

I believe it will resolve issues like https://github.com/JustinBeckwith/retry-axios/issues/198 and https://github.com/JustinBeckwith/retry-axios/issues/193

seidelmartin commented 11 months ago

Hi @JustinBeckwith, would you please check this PR or at least give some feedback?

JustinBeckwith commented 11 months ago

Greetings! While I appreciate the PR - I'm not really interested in adding dual CJS support. ES Modules have been out for quite some time, and many, many modules have moved towards ESM only. I'm not really looking for the additional testing and maintenance burden of dual support.