-
Notifications
You must be signed in to change notification settings - Fork 59
"Cannot find module 'http-status' or its corresponding type declarations." after migrating to 2.0.0 #53
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
Comments
same here |
It seems like you are using TypeScript. The repo http-status-import-bug provided above is configured for CommonJS.
|
You can import it from import httpStatus from 'http-status'; to import httpStatus from 'http-status/dist'; Will work, but ideally it would indeed just keep working as it was. |
Please share your envionnement (Browser/Node.js, CommonJS/ESM, JS/TS, ...). For example, there shouldn't be a need to import |
I'll look into a repro this evening, but TLDR I can't get it to work with CommonJS without importing from the /dist sub-folder. |
With Node.js and without TypeScript ? |
Node.js 20, compiled with tsc from TS to JS {
"lib": ["ESNext"],
"module": "CommonJS",
"moduleResolution": "Node",
"target": "ESNext",
} Offtopic: I actually tried switching my entire project to ESM since that has additional benefits, but I'm having trouble with tsconfig paths in ESM since the lib |
Here's a reproducible example → https://github.com/wouterds/http-status-repro. You'll notice that
While if you downgrade |
Describe the bug
After upgrading to
http-status
2.0.0, I get the following error on every import of the package.To Reproduce
npm run build
Additional context
I consider this a bug since the README claims that, for ESM users, the import remains the same.
The text was updated successfully, but these errors were encountered: