swagger-js icon indicating copy to clipboard operation
swagger-js copied to clipboard

Convert swagger-client to ESM

Open char0n opened this issue 3 years ago • 0 comments

Node.js world has moved to native ESM support some time ago. Wee need to get on this train to be able to used ESM or CommonJS packages. If we maintain status quo, we can only use older CommonJS packages.

Resources:

  • https://nodejs.org/docs/latest-v16.x/api/esm.html
  • https://nodejs.org/docs/latest-v16.x/api/packages.html

We already have explicit usage of file extension that was introduced in https://github.com/swagger-api/swagger-js/pull/2320.

We need to add "type": "module" to the package.json as well.

This change should be fully compatible so we should still be using older package fields like main or browser along with new exports.

char0n avatar Jan 14 '22 14:01 char0n