Skip to content

Conversation

ndcunningham
Copy link
Contributor

@ndcunningham ndcunningham commented Jul 25, 2025

Current Behavior

Nx currently installs an outdated @types/node version (18.16.9) which lacks TypeScript definitions for the native fetch API introduced in Node.js 18. This causes "fetch is undefined" TypeScript errors in NestJS projects and other Node.js applications when using webpack transformers or other build tools.

Expected Behavior

The fetch API should be properly typed in TypeScript without requiring additional type packages or workarounds. Users should be able to use the native fetch API in Node.js applications without TypeScript compilation errors.

Related Issue(s)

Fixes #31637
Fixes #29714

@ndcunningham ndcunningham requested review from meeroslav and a team as code owners July 25, 2025 17:36
Copy link

vercel bot commented Jul 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nx-dev Ready Ready Preview Aug 18, 2025 0:02am

@ndcunningham ndcunningham force-pushed the fix/update-types-node-fetch-support branch from b47b5ec to 9751941 Compare July 25, 2025 17:37
Copy link
Contributor

nx-cloud bot commented Jul 25, 2025

View your CI Pipeline Execution ↗ for commit 812c6fe

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 12m 27s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 2m 33s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 7s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 7s View ↗
nx documentation ✅ Succeeded 1m 29s View ↗
nx affected -t e2e-macos-local --parallel=1 --b... ✅ Succeeded 52s View ↗

☁️ Nx Cloud last updated this comment at 2025-08-18 12:59:43 UTC

@ctjhoa
Copy link
Contributor

ctjhoa commented Aug 18, 2025

Fixes #29714 too

ndcunningham and others added 2 commits August 18, 2025 12:31
- Update @types/node from 18.16.9 to 20.19.9 across all packages
- Resolves "fetch is undefined" TypeScript errors in NestJS projects
- Aligns with Nx's base Node.js 20.19.0 support requirement

Fixes #31637
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
@Coly010 Coly010 force-pushed the fix/update-types-node-fetch-support branch from 7da119a to 812c6fe Compare August 18, 2025 11:42
Copy link

netlify bot commented Aug 18, 2025

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 812c6fe
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/68a311961223b70008f25e45
😎 Deploy Preview https://deploy-preview-32092--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Coly010 Coly010 merged commit 6ce1061 into master Aug 18, 2025
10 of 11 checks passed
@Coly010 Coly010 deleted the fix/update-types-node-fetch-support branch August 18, 2025 13:00
FrozenPandaz added a commit that referenced this pull request Aug 18, 2025
FrozenPandaz pushed a commit that referenced this pull request Aug 22, 2025
## Current Behavior

Nx currently installs an outdated `@types/node` version (18.16.9) which
lacks TypeScript definitions for the native `fetch` API introduced in
Node.js 18. This causes "fetch is undefined" TypeScript errors in NestJS
projects and other Node.js applications when using webpack transformers
or other build tools.

## Expected Behavior

The `fetch` API should be properly typed in TypeScript without requiring
additional type packages or workarounds. Users should be able to use the
native fetch API in Node.js applications without TypeScript compilation
errors.

## Related Issue(s)

Fixes #31637
Fixes #29714

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Colum Ferry <cferry09@gmail.com>
(cherry picked from commit 6ce1061)
Copy link
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@types/node issue with any webpack plugin : "fetch" is undefined Outdated Node Types in Nx Default Configuration
4 participants