-
Notifications
You must be signed in to change notification settings - Fork 203
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 in version 1.2.1 #56
Comments
This works for me: const Hashids = require('hashids');
const h = new Hashids();
console.log(h.encode(1, 2, 3)); How are you using it? And what version of Node? cc @niieani |
Running into the same problem. Using Node 8.11.3 and requiring it via: import Hashids from 'hashids'
// ...
const generator = new Hashids('Not Real', 5, 'ABCDEFGHJKMNPQRTWXY234689') which transpiles into: var _hashids = require('hashids');
var _hashids2 = _interopRequireDefault(_hashids);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//...
var generator = new _hashids2.default('Not Real', 5, 'ABCDEFGHJKMNPQRTWXY234689') via babel |
Fix importing via babel interop (fixes #56)
@ivanakimov The issue is still there. |
@catriuspham can you make a minimal reproduction repo please? I've added 5 tests to cover various ways of importing/requiring hashids, including the one you cited: https://github.com/ivanakimov/hashids.js/blob/master/tests/requiring.js#L13 |
@niieani In 1.2.2, the issue can be temporarily fixed with var Hashids = require('hashids').default; Hope this help. I'm kinda busy now so I don't have time to reproduce the bug any further. For my own project, I just pin the version to the bug-free verrsion 1.0.2. |
Closing. If still an issue, please re-open with reproducible code. |
🎉 This issue has been resolved in version 2.0.0-prerelease.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
wrong order was causing babel interop to fail
Fix importing via babel interop (fixes #56)
🎉 This issue has been resolved in version 2.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I just updated to the newest version and encountered this error:
TypeError: Object is not a constructor (evaluating 'new Hashids()')
The text was updated successfully, but these errors were encountered: