ucan-wg / ts-ucan

Auth tokens for a distributed, user-controlled world
https://www.npmjs.com/package/ucans
Apache License 2.0
102 stars 12 forks source link

Fix ESM build #92

Closed Frando closed 2 years ago

Frando commented 2 years ago

In ESM, other than in CJS, file endings are not automatically appended to import paths. The TypeScript compiler does not change this behavior; it emits the import statements exactly as written in the TypeScript source file. Imports without .js endings are only valid for either packages or named exports set in a package's package.json.

This PR fixes the few spots where currently imports without file names are used. This makes the package compatible with Node.js in ESM mode.

I did not yet change all test imports, as they are not included in the published bundle anyways.

Fixes #91