-
Notifications
You must be signed in to change notification settings - Fork 27k
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
TypeScript errors due to missing @types/react-dom and @types/webpack when using "strict": true
and "skipLibCheck": false
#16219
Comments
Workaround for vercel/next.js#16219
Workaround for vercel/next.js#16219
Any updates on this? I'm getting same error and find it weird that I have to have types available to build in production. |
I'm getting the same error and had to disable |
This is still happening with Next 11, although only |
Still happening in Next 12. Any ideas? |
This comment has been minimized.
This comment has been minimized.
For others my solution was to install all packages, but prune dev dependencies after build like so:
It works fine, but it It would be better if this error didn't occur and we could just do |
Please verify that your issue can be recreated with Why was this issue marked with the
|
This issue has been automatically closed because it wasn't verified against next@canary. If you think it was closed by accident, please leave a comment. If you are running into a similar issue, please open a new issue with a reproduction. Thank you. |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
When setting
tsconfig.json
options"skipLibCheck": false
and"strict": true
, TypeScript errors are raised due to missing dependencies@types/react-dom
and@types/webpack
.As a workaround, a Next.js project can declare these as dependencies in
package.json
, but this shouldn't be necessary.To Reproduce
First, initialize a Next.js app with TypeScript:
Then edit
tsconfig.json
: set"strict": true
and"skipLibCheck": false
. Try building again:Install
@types/react-dom
as a workaround and this error is resolved, but there's a new error:Install
@types/webpack
, then we get a successful build:Expected behavior
The Next.js app should build successfully without having to install
@types/react-dom
and@types/webpack
.System information
The text was updated successfully, but these errors were encountered: