-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: AwaitLock is not a constructor #5
Comments
Published a backwards compatibility fix in 1.2.1. I had to manually modify the build output so there is no commit that corresponds to this version of the package. Moving forward, this will not be supported in 2.0.0. |
Having this problem to. Is it not possible to create an instance of |
The issue is with the way the module is loaded, not the constructor. Use ESM, either natively or with tsc, Babel, SWC, etc. |
I'm running into the same issue. Not sure what you mean. Everything else loads fine. Not this module. How to resolve this? import AwaitLock from 'await-lock';
....
this.mutex = new AwaitLock();
tsconfig.json: "compilerOptions": {
"module": "es2022",
"moduleResolution": "node",
"lib": ["es2020"],
"target": "es2020",
"esModuleInterop": true, |
It's a export default module error. It can be fixed easily with adding Working example: const AwaitLock = require('await-lock').default;
let lock = new AwaitLock(); |
With the new version 1.2.0 this piece of code throws the error
TypeError: AwaitLock is not a constructor
This works with 1.1.3 version.
The text was updated successfully, but these errors were encountered: