Import with CommonJS
Mathie01 opened this issue · comments
Mathie01 commented
Hi !
Thank you for this library.
It's possible to import the library in CommonJS ?
Thanks!
Alex Grant commented
Yes, the output is transpiled to interoperate. Here's how to use plain old require
:
const hashstream = require('@localnerve/csp-hashes').default;
or
const { default: hashstream } = require('@localnerve/csp-hashes');
Alex Grant commented
FUTURE NOTE:
To use 2.0.0+ package version without ESM, you must use dynamic import:
import('@localnerve/csp-hashes')
.then(({ default: hashstream }) => {
hashstream({
// options
});
});