[Snyk] Upgrade @nuxt/kit from 4.1.3 to 4.2.0 #28
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Snyk has created this PR to upgrade @nuxt/kit from 4.1.3 to 4.2.0.
ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.
The recommended version is 1 version ahead of your current version.
The recommended version was released a month ago.
Release notes
Package name: @nuxt/kit
-
4.2.0 - 2025-10-25
script setup lang="ts">
const { data, refresh } = await useAsyncData('posts', fetchPosts)

- Precomputed renderer dependencies – We now compute renderer dependencies at build time rather than runtime, improving cold start and initial render performance (#33361)
- Reduced dependencies – Removed unnecessary dependencies from kit and schema packages (7ae2cf563)
script setup lang="ts">
- Smart component renaming: Automatically updates all references when you rename auto-imported component files
- Go to definition for dynamic imports: Navigate directly to files when using glob patterns like
- Nitro route navigation: Jump to server route handlers from data fetching functions (
- Runtime config navigation: Go to definition works seamlessly with runtime config properties
- Enhanced auto-import support: Includes the
- Component
- Module resolution extensions – Kit's
- Global head utility – New
- Route hash is now preserved when redirecting based on
- Fixed concurrent calls to
- Object-format
- Component auto-imports now work as arguments to Vue's
- Fixed app config array handling during HMR (#33555)
- nuxt: Allow specifying component
- kit: Add
- nuxt: Add abortController option to
- nuxt: Display youch error page w/ user error page in dev (#33359)
- nuxt: Experimental typescript plugin support (#33314)
- nuxt,schema: Extract asyncData handlers to chunks (#33131)
- schema: Enable setting
- kit,vite: Allow enabling vite environment api (#33492)
- kit: Add
- nuxt: Precompute renderer dependencies at build time (#33361)
- kit,schema: Remove some unnecessary dependencies (7ae2cf563)
- nuxt: Preserve hash with redirecting based on
- kit: Safely cleanup
- nuxt: Allow object-format
- nuxt: Remove
- nuxt: Add back
- nuxt: Do not allow native attrs to shadow nuxt link props (4751a6aca)
- nuxt: Remove
- nuxt: Preserve root route in
- nuxt: Exempt webpack vfs from pkg lookup (285eac31c)
- nitro: Exempt nightly release from import protections (dd522394a)
- webpack,rspack: Preserve prerender + nitro flags in server builds (#33503)
- nuxt: Support component auto-imports as arguments of
- vite: Prevent assignment for rolldown's replacement plugin (#33526)
- nuxt: Use sha256 hash for prerender cache keys (#33505)
- nuxt: Add
- nuxt: Add
- nuxt: Handle arrays in app config correctly during HMR (#33555)
- vite: Unset
- Remove obsolete
- kit: Extract trace utilities (9687505ac)
- nuxt,vite,webpack: Allow builders to augment types (#33427)
- schema: Deprecate
- vite: Make vite plugins environment-compatible (#33445)
- nitro,nuxt: Extract
- nuxt: Use
- Update link to localisation issue (d32859da2)
- Add nuxt module
- Remove deprecated node version (#33411)
- Update
- Reproduction links for Nuxt v4 (#33429)
- Add some notes/deprecations for vite hooks (31c5f26a2)
- Fix incorrect ESM module field info (#33451)
- Recommend
- Add
- Add docs for
- Clarify extends removal in TypeScript config migration (#33523)
- Pin codemod to v0.18.7 for migration recipe (#33522)
- Fix links (#33554)
- Migrate gitpod to ona (#33159)
- Use native node to run
- Do not use native node to run
- Lint docs (3b9784111)
- Update valid semantic scopes (3c38d1f8b)
- Ignore nitro templates (27cf85bdc)
- Update internal links (aac763017)
- Remove
- Update vscode url (#33360)
- Correct jsdoc location for function used as parameters (#33507)
- Remove code comment (#33515)
- Patch changelogen for large numbers of commits (bd36738b8)
- Link Nuxt 1.x and 2.x (2016–2022) history to main (85838dfd9)
- Filter out commits before last tag when constructing changelog (1c561daeb)
- Also respect since date for bump type (08900f610)
- Also respect
- Ignore
- Refactor suite to use common matrix utils (#33483)
- Publish
- Remove nitro-server publish until v4.2 is released (904d4f6ec)
- 山吹色御守 (@ KazariEX)
- Florian Heuberger (@ Flo0806)
- Daniel Roe (@ danielroe)
- Matej Černý (@ cernymatej)
- Trung Dang (@ NamesMT)
- 纸鹿/Zhilu (@ L33Z22L11)
- Julien Huang (@ huang-julien)
- Alexander Lichter (@ TheAlexLichter)
- abeer0 (@ iiio2)
- Max (@ onmax)
- Daniel Slepov (@ imslepov)
- Octavio Araiza (@ 8ctavio)
- Bobbie Goede (@ BobbieGoede)
- DipakHalkude (@ DipakHalkude)
- Aleksander Błaszkiewicz (@ ablaszkiewicz)
-
4.1.3 - 2025-10-06
- vite: Use rolldown's replace plugin when applicable (#33258)
- kit: Add default values when adding type references in
- nuxt: Augment app config in server context (#33287)
- nuxt: Make lazy component types compatible with
- vite: Deduplicate inlined server style chunks (#33308)
- nuxt: Support
- nuxt: Do not relativise importmap if
- nuxt: Resolve aliases in
- nuxt: Add missing element/vnode props for
- nuxt: Do not generate server placeholder components (#33345)
- nuxt: Dedupe generated component names (#33346)
- webpack: Test watch instance before closing it (0e5a0a5a0)
- nuxt: Correctly handle island rendering error (#33302)
- nuxt: Support
- nuxt: Support
- nuxt: Don't trigger scroll when changing trailing slash (#33358)
- nuxt: Add stubs for new scripts from
- nuxt: Prevent duplicate execution on key change in
- nuxt: Make middleware
- nuxt: Handle non-immediate
- nuxt: Improve implementation of error composables (#33234)
- nuxt: Resolve path of
- nuxt: Move server references to
- nuxt: Place
- nuxt,vite: Use environment-api compatible plugins (#33403)
- Add
- Fix more links (#33265)
- Update usage instructions for Windows users (#33284)
- Update app config paths to use app/app.config.ts (#33297)
- Remove d suffix in example (#33298)
- Move directory structure to top-level (#33299)
- Add information about
- Add more
- Lint code samples within docs (#33271)
- Remove duplicated documentation from
- Remove docs for outdated asyncData configuration (3e4a999e6)
- Note
- Update
- Temporarily disable link to github sponsors (7e5375390)
- Update markdownlint ignore (19fc9abbb)
- Migrate pnpm settings out of
- Ignore errors from npmjs (50febbbba)
- Lint (09a16d9df)
- nuxt: Align global components indent (#33340)
- Remove tea.yaml (5f567c79b)
- Remove todo comment as resolved (#33389)
- nuxt: Set locale to en for nuxt-time tests (#33343)
- Double
- Add provenance action to check for downgrades in provenance (5ada6861e)
- Pass commit sha when triggering ecosystem ci (399df6bab)
- Daniel Roe (@ danielroe)
- 山吹色御守 (@ KazariEX)
- Julien Huang (@ huang-julien)
- Florian Heuberger (@ Flo0806)
- Ondrej Brendy (@ bandiasek)
- Octavio Araiza (@ 8ctavio)
- Alex Liu (@ Mini-ghost)
- Bobbie Goede (@ BobbieGoede)
- abeer0 (@ iiio2)
- Harlan Wilton (@ harlan-zw)
- Alexander Lichter (@ TheAlexLichter)
- Sébastien Chopin (@ atinux)
- Ben Hong (@ bencodezen)
- Daniel Slepov (@ imslepov)
- Huseyn Guliyev (@ husayt)
- Hillary (@ hillaryke)
from @nuxt/kit GitHub release notes👀 Highlights
We're excited to announce Nuxt 4.2, bringing new capabilities for better TypeScript DX, enhanced error handling, and improved control over data fetching! 🎉
🎯 Abort Control for Data Fetching
You can now use
AbortControllersignals directly withinuseAsyncData, giving you fine-grained control over request cancellation (#32531).This works by passing an internal signal to your
useAsyncDatahandlerto cancel any promise that can be canceled, such as$fetch.const controller = new AbortController()
const { data, error, clear, refresh } = await useAsyncData('users', (_nuxtApp, { signal }) => $fetch('/api/users', {
signal
}))
refresh() // will actually cancel the $fetch request (if dedupe: cancel)
refresh() // will actually cancel the $fetch request (if dedupe: cancel)
refresh()
clear() // will cancel the latest pending handler
</script>
You also pass an
AbortControllersignal directly torefresh/execute, giving you fine-grained control over request cancellation. This is particularly useful when you need to abort requests based on user actions or component lifecycle events.// Abort an ongoing refresh
const abortController = new AbortController()
refresh({ signal: abortController.signal })
// Later...
abortController.abort()
🎨 Better Error Pages in Development
When an error occurs during development, Nuxt will now display both your custom error page and a detailed technical error overlay (#33359). This gives you the best of both worlds – you can see what your users will experience while also having immediate access to stack traces and debugging information.
The technical overlay appears as a toggleable panel that doesn't interfere with your custom error page, making it easier to debug issues while maintaining a realistic preview of your error handling.
🔮 Opt-in Vite Environment API
For those wanting to experiment with cutting-edge features, you can now opt into the Vite Environment API (#33492).
The Vite Environment API is a major architectural improvement in Vite 6. It closes the gap between development and production by allowing the Vite dev server to handle multiple environments concurrently (rather than requiring multiple Vite dev servers, as we have done previously in Nuxt).
This should improve performance when developing and eliminate some edge case bugs.
... and it is the foundation for implementing Nitro as a Vite environment, which should speed up the dev server still further, as well as allowing more greater alignment in development with your Nitro preset.
This is also the first breaking change for Nuxt v5. You can opt in to these breaking changes by setting
compatibilityVersionto5:Please only use this for testing, as this opts in to unlimited future breaking changes, including updating to Nitro v3 once we ship the Nuxt integration.
Warning
This is highly experimental and the API may change. Only enable if you're prepared for potential breaking changes and want to help shape the future of Nuxt!
📦 New
@ nuxt/nitro-serverPackageWe've extracted Nitro server integration into its own package:
@ nuxt/nitro-server(#33462). This architectural change allows for different Nitro integration patterns and paves the way for future innovations in server-side rendering.While this change is mostly internal, it's part of our ongoing effort to make Nuxt more modular and flexible. The new package provides standalone Nitro integration and sets the foundation for alternative integration approaches (such as using Nitro as a Vite plugin in Nuxt v5+).
Note
This is an internal refactor – no changes should be required in your code.
⚡ Performance Improvements
We've also shipped several performance enhancements:
📉 Async Data Handler Extraction
One of the most exciting performance improvements is the new experimental async data handler extraction (#33131). When enabled, handler functions passed to
useAsyncDataanduseLazyAsyncDataare automatically extracted into separate chunks and dynamically imported.This is particularly effective for prerendered static sites, as the data fetching logic is only needed at build time and can be completely excluded from the client bundle.
Note
In testing with a previous version of nuxt.com, this feature reduced JavaScript bundle size by 39%! Of course, your mileage may vary depending on how much data fetching logic you have.
// This handler will be extracted into a separate chunk
// and only loaded when needed
const { data: post } = await useAsyncData('post', async () => {
const content = await queryContent(
</span><span class="pl-s">/blog/${<span class="pl-smi">route</span>.<span class="pl-smi">params</span>.<span class="pl-smi">slug</span>}</span><span class="pl-s">).findOne()// Complex data processing that you don't want in the client bundle
const processed = await processMarkdown(content)
const related = await findRelatedPosts(content.tags)
return {
...processed,
related
}
})
</script>
For static/prerendered sites, enable it in your config:
The extracted handlers are then tree-shaken from your client bundle when prerendering, as the data is already available in the payload. This results in significantly smaller JavaScript files shipped to your users.
🔧 Experimental TypeScript Plugin Support
We're introducing experimental support for enhanced TypeScript developer experience through the
@ dxup/nuxtmodule.This module adds a number of TypeScript plugins that aim to improve your experience when using Nuxt-specific features:
import(\~/assets/${name}.webp`)`$fetch,useFetch,useLazyFetch)@ dxup/unimportplugin for better navigation with auto-imported composables and utilitiesNote
Read more in the documentation.
To enable this feature, set
experimental.typescriptPlugintotruein your Nuxt configuration:Once enabled, the module will be automatically installed and configured by Nuxt.
Important
This feature also requires selecting the workspace TypeScript version in VS Code. Run the "TypeScript: Select TypeScript Version" command and choose "Use Workspace Version".
🎁 Other Improvements
declarationPath– You can now specify a custom declaration path for components (#33419)resolveModulenow accepts anextensionsoption (#33328)setGlobalHeadutility in kit for easier head management (#33512)🩹 Important Fixes
routeRules(#33222)loadNuxtConfigwith proper cleanup (#33420)hrefnow works correctly in<NuxtLink>(c69e4c30d)h()function (#33509)✅ Upgrading
Our recommendation for upgrading is to run:
This will refresh your lockfile and pull in all the latest dependencies that Nuxt relies on, especially from the unjs ecosystem.
👉 Changelog
compare changes
🚀 Enhancements
declarationPath(#33419)extensionsoption forresolveModule(#33328)useAsyncData(#32531)future.compatibilityVersionto5(22f4693a1)setGlobalHeadutility (#33512)🔥 Performance
🩹 Fixes
routeRules(#33222)loadNuxtConfigin concurrent calls (#33420)hrefin<NuxtLink>(c69e4c30d)mergeModelsfrom auto imports (#33344)shortPathproperty (#33384)declarationPathfrom component dirs (191bcb7e9)isPrerenderedcheck (#33476)h()(#33509)NuxtTimerelative timenumericprop (#33552)NuxtTimerelative timerelativeStyleprop (#33557)optimizeDeps.includefor server environment (#33550)💅 Refactors
shortPathproperty (#33384)extend,extendConfig, andconfigResolvedhooks (e060b9695)@ nuxt/nitro-serverpackage (#33462)RouteLocationNormalizedLoadedGenericinternally (b51cb3067)📖 Documentation
addServerPluginnote (#33409)declarationPathinaddComponent(#33380)getLayerDirectories()instead ofnuxt.options._layers(#33484)4.xprefix (5c0bb9285)moduleDependencies(#33499)🏡 Chore
test:prepare(6ef632b82)test:prepare(eca36cfe5)vue-demifromignoredBuiltDependencies(#33494)sincein nightly releases (74ca73ca1)@ rollup/plugin-commonjs(cd12980ce)✅ Tests
🤖 CI
@ nuxt/nitro-serveron pkg-pr-new (b7ccf17bf)❤️ Contributors
✅ Upgrading
Our recommendation for upgrading is to run:
This will deduplicate your lockfile as well, and help ensure that you pull in updates from other dependencies that Nuxt relies on, particularly in the unjs ecosystem.
👉 Changelog
compare changes
🔥 Performance
🩹 Fixes
prepare:typeshook (#33239)h(#33046)headoption onuseHead(#33318)cdnURLis set (#33333)imports.dirs(#33334)<NuxtLink>(#33335)v-slot:fallbacklongform syntax in<DevOnly>(#33368)typeFromwhen generating auto-import type templates (#33373)@ nuxt/scripts(bed410d60)useAsyncData(#33325)_pathproperty configurable for HMR (#33379)useAsyncDatawith different key on ssr (#33341)💅 Refactors
typed-router.d.tsearly for consistency (#33285)nitro:prepare:typeshook (#33286)filenameintocomponentsIslandsTemplatedefinition (#33394)📖 Documentation
4.xprefix to all internal links (#33264)useFetchreactivity (#33317)4.xprefixes in urls (47ea684c7)nuxt.configpage (b438d44e1)preparecommandNODE_ENVbehavior (#33330)nuxtcommand pages (#33336)🏡 Chore
.npmrc(14514329b)✅ Tests
gotoPathtimeout in CI (f1e5a2d4c)🤖 CI
❤️ Contributors
Important
Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.
For more information: