Hinaser / jscrypto

Crypto library for Node/ES6/Typescript/Browser.
MIT License
37 stars 6 forks source link

es6 build needs to use mjs file extension or specify `"type": "module"` in a parent `package.json` file. #15

Open segevfiner opened 1 year ago

segevfiner commented 1 year ago

Without this, more strict bundlers and Node's ESM mode won't be able to import the es6 build of jscrypto.

e.g. From vitest:

SyntaxError: Cannot use import statement outside a module
Module .../node_modules/.pnpm/jscrypto@1.0.3/node_modules/jscrypto/es6/lib/random.js:1 seems to be an ES Module but shipped in a CommonJS package. You might want to create an issue to the package "jscrypto" asking them to ship the file in .mjs extension or add "type": "module" in their package.json.