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
Improve documentation about how to import in Typescript+Node<13.11 #210
Comments
@peps have the same issue, Temporarily fixed with: declare let require: any;
const Hashids = require('hashids/cjs'); Would be good to have an update on this |
this works for me |
See README: https://github.com/niieani/hashids.js#use-in-commonjs-environments-most-often-nodejs |
I'd like to take this on if no one is working on it! |
@YashdalfTheGray go for it! |
I created #474 to hopefully close this! |
🎉 This issue has been resolved in version 2.2.9 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hi, im trying to use Hashids with Typescript and Node.
import Hashids from 'hashids';
I'm not getting any Typescript errors in the editor, but Im getting this error when the code is compiled.
Using ts-node version 8.5.4, typescript version 3.7.5
Error: No valid exports main found for 'node_modules\hashids' at resolveExportsTarget (internal/modules/cjs/loader.js:625:9) at applyExports (internal/modules/cjs/loader.js:502:14) at resolveExports (internal/modules/cjs/loader.js:551:12) at Function.Module._findPath (internal/modules/cjs/loader.js:657:22) at Function.Module._resolveFilename (internal/modules/cjs/loader.js:960:27) at Function.Module._load (internal/modules/cjs/loader.js:855:27) at Module.require (internal/modules/cjs/loader.js:1033:19) at require (internal/modules/cjs/helpers.js:72:18) at Object.<anonymous> (encodeID.ts:1:1) at Module._compile (internal/modules/cjs/loader.js:1144:30) [ERROR] 18:03:43 Error: No valid exports main found for 'node_modules\hashids'
Thanks!
The text was updated successfully, but these errors were encountered: