self is not defined
Recently when deploying, we started getting this error:
ReferenceError: self is not defined
And it appears this issue occurs came about after it auto-upgraded to the latest 2.2.10, where previously we were using on 2.2.3 without issue.
We are currently using it via:
import Hashids from 'hashids/dist/hashids';
which isn't ideal but it works. We can'r enable esModuleInterop to true because that breaks other packages.
Any ideas what to do here?
Hi @jaequery, can you give an example of how were you using it that it was broken?
dist is for web browser usage.
cjs and esm are for node.js or webpack.
If you use the dist files in node.js environment directly, you will get that error: ReferenceError: self is not defined
If you want to use dist for node.js, you should do a little modification:
replace self with ("object"==typeof self?self:{})
then it will can run both in browser and node.js