101arrowz / fzstd

High performance Zstandard decompression in a pure JavaScript, 8kB package
MIT License
218 stars 11 forks source link

Importing this from node fails #5

Closed Gozala closed 2 years ago

Gozala commented 2 years ago

I get following errors in node v16.13.0 when importing this

(node:18561) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)

./node_modules/fzstd/esm/index.js:40
export var ZstdErrorCode = {

As far as I can tell node does not like export because "type": "module" is not set in package.json so it treats it as cjs instead.

101arrowz commented 2 years ago

I can fix this by changing the extension to .mjs for the exported ESM files. I'll do that when I get a chance.

101arrowz commented 2 years ago

Thanks for the PRs, fixed in v0.0.4.