Build stability has been significantly improved with import maps (#33075). This prevents cascading hash changes that could invalidate large portions of your build when small changes are made:
By default, JS chunks emitted in a Vite build are hashed, which means they can be cached immutably. However, this can cause a significant issue: a change to a single component can cause every hash to be invalidated, massively increasing the chance of 404s.
In short:
a component is changed slightly - the hash of its JS chunk changes
the page which uses the component has to be updated to reference the new file name
the entry now has its hash changed because it dynamically imports the page
every other file which imports the entry has its hash changed because the entry file name is changed
Obviously this wasn't optimal. With this new feature, the hash of (otherwise) unchanged files which import the entry won't be affected.
This feature is automatically enabled and helps maintain better cache efficiency in production. It does require native import map support, but Nuxt will automatically disable it if you have configured vite.build.target to include a browser that doesn't support import maps.
Nuxt now includes experimental support for rolldown-vite (#31812), bringing Rust-powered bundling for potentially faster builds.
To try Rolldown in your Nuxt project, you need to override Vite with the rolldown-powered version since Vite is a dependency of Nuxt. Add the following to your package.json:
After adding the override, reinstall your dependencies. Nuxt will automatically detect when Rolldown is available and adjust its build configuration accordingly.
[!NOTE]
This is experimental and may have some limitations, but offers a glimpse into the future of high-performance bundling in Nuxt.
🧪 Improved Lazy Hydration
Lazy hydration macros now work without auto-imports (#33037), making them more reliable when component auto-discovery is disabled:
<scriptsetup>// Works even with components: false
constLazyComponent=defineLazyHydrationComponent('visible',()=>import('./MyComponent.vue'))</script>
This ensures that components that are not "discovered" through Nuxt (e.g., because components is set to false in the config) can still be used in lazy hydration macros.
📄 Enhanced Page Rules
If you have enabled experimental extraction of route rules, these are now exposed on a dedicated rules property on NuxtPage objects (#32897), making them more accessible to modules and improving the overall architecture:
// In your module
nuxt.hook('pages:extend',pages=>{pages.push({path:'/api-docs',rules:{prerender: true,cors: true,headers:{'Cache-Control':'s-maxage=31536000'}}})})
The defineRouteRules function continues to work exactly as before, but now provides better integration possibilities for modules.
🚀 Module Development Enhancements
Module Dependencies and Integration
Modules can now specify dependencies and modify options for other modules (#33063). This enables better module integration and ensures proper setup order:
exportdefaultdefineNuxtModule({meta:{name:'my-module',},moduleDependencies:{'some-module':{// You can specify a version constraint for the module
version:'>=2',// By default moduleDependencies will be added to the list of modules
// to be installed by Nuxt unless `optional` is set.
optional: true,// Any configuration that should override `nuxt.options`.
overrides:{},// Any configuration that should be set. It will override module defaults but
// will not override any configuration set in `nuxt.options`.
defaults:{}}},setup(options,nuxt){// Your module setup logic
}})
This replaces the deprecated installModule function and provides a more robust way to handle module dependencies with version constraints and configuration merging.
🪝 Module Lifecycle Hooks
Module authors now have access to two new lifecycle hooks: onInstall and onUpgrade (#32397). These hooks allow modules to perform additional setup steps when first installed or when upgraded to a new version:
exportdefaultdefineNuxtModule({meta:{name:'my-module',version:'1.0.0',},onInstall(nuxt){// This will be run when the module is first installed
console.log('Setting up my-module for the first time!')},onUpgrade(inlineOptions,nuxt,previousVersion){// This will be run when the module is upgraded
console.log(`Upgrading my-module from v${previousVersion}`)}})
The hooks are only triggered when both name and version are provided in the module metadata. Nuxt uses the .nuxtrc file internally to track module versions and trigger the appropriate hooks. (If you haven't come across it before, the .nuxtrc file should be committed to version control.)
[!TIP]
This means module authors can begin implementing their own 'setup wizards' to provide a better experience when some setup is required after installing a module.
🙈 Enhanced File Resolution
The new ignore option for resolveFiles (#32858) allows module authors to exclude specific files based on glob patterns:
// Resolve all .vue files except test files
constfiles=awaitresolveFiles(srcDir,'**/*.vue',{ignore:['**/*.test.vue','**/__tests__/**']})
📂 Layer Directories Utility
A new getLayerDirectories utility (#33098) provides a clean interface for accessing layer directories without directly accessing private APIs:
import{getLayerDirectories}from'@​nuxt/kit'constlayerDirs=awaitgetLayerDirectories(nuxt)// Access key directories:
// layerDirs.app - /app/ by default
// layerDirs.appPages - /app/pages by default
// layerDirs.server - /server by default
// layerDirs.public - /public by default
✨ Developer Experience Improvements
🎱 Simplified Kit Utilities
Several kit utilities have been improved for better developer experience:
addServerImports now supports single imports (#32289):
// Before: required array
addServerImports([{from:'my-package',name:'myUtility'}])// Now: can pass directly
addServerImports({from:'my-package',name:'myUtility'})
🔥 Performance Optimizations
This release includes several internal performance optimizations:
This MR contains the following updates:
| Package | Change | Age | Confidence |
|---|---|---|---|
| [nuxt](https://nuxt.com) ([source](https://github.com/nuxt/nuxt/tree/HEAD/packages/nuxt)) | [`4.0.3` -> `4.1.0`](https://renovatebot.com/diffs/npm/nuxt/4.0.3/4.1.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) |
---
### Release Notes
<details>
<summary>nuxt/nuxt (nuxt)</summary>
### [`v4.1.0`](https://github.com/nuxt/nuxt/releases/tag/v4.1.0)
[Compare Source](https://github.com/nuxt/nuxt/compare/v4.0.3...v4.1.0)
#### 👀 Highlights
##### 🔥 Build and Performance Improvements
##### 🍫 Enhanced Chunk Stability
Build stability has been significantly improved with import maps ([#​33075](https://github.com/nuxt/nuxt/pull/33075)). This prevents cascading hash changes that could invalidate large portions of your build when small changes are made:
```html
<!-- Automatically injected import map -->
<script type="importmap">{"imports":{"#entry":"/_nuxt/DC5HVSK5.js"}}</script>
```
By default, JS chunks emitted in a Vite build are hashed, which means they can be cached immutably. However, this can cause a significant issue: a change to a single component can cause *every* hash to be invalidated, massively increasing the chance of 404s.
In short:
1. a component is changed slightly - the hash of its JS chunk changes
2. the page which uses the component has to be updated to reference the new file name
3. the *entry* now has its hash changed because it dynamically imports the page
4. ***every other file*** which imports the entry has its hash changed because the entry file name is changed
Obviously this wasn't optimal. With this new feature, the hash of (otherwise) unchanged files which import the entry won't be affected.
This feature is automatically enabled and helps maintain better cache efficiency in production. It does require [native import map support](https://caniuse.com/import-maps), but Nuxt will automatically disable it if you have configured `vite.build.target` to include a browser that doesn't support import maps.
And of course you can disable it if needed:
```ts [nuxt.config.ts]
export default defineNuxtConfig({
experimental: {
entryImportMap: false
}
})
```
##### 🦀 Experimental Rolldown Support
Nuxt now includes experimental support for `rolldown-vite` ([#​31812](https://github.com/nuxt/nuxt/pull/31812)), bringing Rust-powered bundling for potentially faster builds.
To try Rolldown in your Nuxt project, you need to override Vite with the rolldown-powered version since Vite is a dependency of Nuxt. Add the following to your `package.json`:
**npm**:
```json
{
"overrides": {
"vite": "npm:rolldown-vite@latest"
}
}
```
**pnpm**:
```json
{
"pnpm": {
"overrides": {
"vite": "npm:rolldown-vite@latest"
}
}
}
```
**yarn**:
```json
{
"resolutions": {
"vite": "npm:rolldown-vite@latest"
}
}
```
**bun**:
```json
{
"overrides": {
"vite": "npm:rolldown-vite@latest"
}
}
```
After adding the override, reinstall your dependencies. Nuxt will automatically detect when Rolldown is available and adjust its build configuration accordingly.
For more details on Rolldown integration, see the [Vite Rolldown guide](https://vite.dev/guide/rolldown).
> \[!NOTE]
> This is experimental and may have some limitations, but offers a glimpse into the future of high-performance bundling in Nuxt.
##### 🧪 Improved Lazy Hydration
Lazy hydration macros now work without auto-imports ([#​33037](https://github.com/nuxt/nuxt/pull/33037)), making them more reliable when component auto-discovery is disabled:
```vue
<script setup>
// Works even with components: false
const LazyComponent = defineLazyHydrationComponent(
'visible',
() => import('./MyComponent.vue')
)
</script>
```
This ensures that components that are not "discovered" through Nuxt (e.g., because `components` is set to `false` in the config) can still be used in lazy hydration macros.
##### 📄 Enhanced Page Rules
If you have enabled experimental extraction of route rules, these are now exposed on a dedicated `rules` property on `NuxtPage` objects ([#​32897](https://github.com/nuxt/nuxt/pull/32897)), making them more accessible to modules and improving the overall architecture:
```ts
// In your module
nuxt.hook('pages:extend', pages => {
pages.push({
path: '/api-docs',
rules: {
prerender: true,
cors: true,
headers: { 'Cache-Control': 's-maxage=31536000' }
}
})
})
```
The `defineRouteRules` function continues to work exactly as before, but now provides better integration possibilities for modules.
##### 🚀 Module Development Enhancements
##### Module Dependencies and Integration
Modules can now specify dependencies and modify options for other modules ([#​33063](https://github.com/nuxt/nuxt/pull/33063)). This enables better module integration and ensures proper setup order:
```ts
export default defineNuxtModule({
meta: {
name: 'my-module',
},
moduleDependencies: {
'some-module': {
// You can specify a version constraint for the module
version: '>=2',
// By default moduleDependencies will be added to the list of modules
// to be installed by Nuxt unless `optional` is set.
optional: true,
// Any configuration that should override `nuxt.options`.
overrides: {},
// Any configuration that should be set. It will override module defaults but
// will not override any configuration set in `nuxt.options`.
defaults: {}
}
},
setup (options, nuxt) {
// Your module setup logic
}
})
```
This replaces the deprecated `installModule` function and provides a more robust way to handle module dependencies with version constraints and configuration merging.
##### 🪝 Module Lifecycle Hooks
Module authors now have access to two new lifecycle hooks: `onInstall` and `onUpgrade` ([#​32397](https://github.com/nuxt/nuxt/pull/32397)). These hooks allow modules to perform additional setup steps when first installed or when upgraded to a new version:
```ts
export default defineNuxtModule({
meta: {
name: 'my-module',
version: '1.0.0',
},
onInstall(nuxt) {
// This will be run when the module is first installed
console.log('Setting up my-module for the first time!')
},
onUpgrade(inlineOptions, nuxt, previousVersion) {
// This will be run when the module is upgraded
console.log(`Upgrading my-module from v${previousVersion}`)
}
})
```
The hooks are only triggered when both `name` and `version` are provided in the module metadata. Nuxt uses the `.nuxtrc` file internally to track module versions and trigger the appropriate hooks. (If you haven't come across it before, the `.nuxtrc` file should be committed to version control.)
> \[!TIP]
> This means module authors can begin implementing their own 'setup wizards' to provide a better experience when some setup is required after installing a module.
##### 🙈 Enhanced File Resolution
The new `ignore` option for `resolveFiles` ([#​32858](https://github.com/nuxt/nuxt/pull/32858)) allows module authors to exclude specific files based on glob patterns:
```ts
// Resolve all .vue files except test files
const files = await resolveFiles(srcDir, '**/*.vue', {
ignore: ['**/*.test.vue', '**/__tests__/**']
})
```
##### 📂 Layer Directories Utility
A new `getLayerDirectories` utility ([#​33098](https://github.com/nuxt/nuxt/pull/33098)) provides a clean interface for accessing layer directories without directly accessing private APIs:
```ts
import { getLayerDirectories } from '@​nuxt/kit'
const layerDirs = await getLayerDirectories(nuxt)
// Access key directories:
// layerDirs.app - /app/ by default
// layerDirs.appPages - /app/pages by default
// layerDirs.server - /server by default
// layerDirs.public - /public by default
```
##### ✨ Developer Experience Improvements
##### 🎱 Simplified Kit Utilities
Several kit utilities have been improved for better developer experience:
- `addServerImports` now supports single imports ([#​32289](https://github.com/nuxt/nuxt/pull/32289)):
```ts
// Before: required array
addServerImports([{ from: 'my-package', name: 'myUtility' }])
// Now: can pass directly
addServerImports({ from: 'my-package', name: 'myUtility' })
```
##### 🔥 Performance Optimizations
This release includes several internal performance optimizations:
- Improved route rules cache management ([#​32877](https://github.com/nuxt/nuxt/pull/32877))
- Optimized app manifest watching ([#​32880](https://github.com/nuxt/nuxt/pull/32880))
- Better TypeScript processing for page metadata ([#​32920](https://github.com/nuxt/nuxt/pull/32920))
##### 🐛 Notable Fixes
- Improved `useFetch` hook typing ([#​32891](https://github.com/nuxt/nuxt/pull/32891))
- Better handling of TypeScript expressions in page metadata ([#​32902](https://github.com/nuxt/nuxt/pull/32902), [#​32914](https://github.com/nuxt/nuxt/pull/32914))
- Enhanced route matching and synchronization ([#​32899](https://github.com/nuxt/nuxt/pull/32899))
- Reduced verbosity of Vue server warnings in development ([#​33018](https://github.com/nuxt/nuxt/pull/33018))
- Better handling of relative time calculations in `<NuxtTime>` ([#​32893](https://github.com/nuxt/nuxt/pull/32893))
#### ✅ Upgrading
As usual, our recommendation for upgrading is to run:
```sh
npx nuxt upgrade --dedupe
```
This will refresh your lockfile and pull in all the latest dependencies that Nuxt relies on, especially from the unjs ecosystem.
#### 👉 Changelog
[compare changes](https://github.com/nuxt/nuxt/compare/v4.0.3...v4.1.0)
##### 🚀 Enhancements
- **kit:** Add `ignore` option to `resolveFiles` ([#​32858](https://github.com/nuxt/nuxt/pull/32858))
- **kit:** Add `onInstall` and `onUpgrade` module hooks ([#​32397](https://github.com/nuxt/nuxt/pull/32397))
- **nuxt,vite:** Add experimental support for `rolldown-vite` ([#​31812](https://github.com/nuxt/nuxt/pull/31812))
- **nuxt:** Extract `defineRouteRules` to page `rules` property ([#​32897](https://github.com/nuxt/nuxt/pull/32897))
- **nuxt,vite:** Use importmap to increase chunk stability ([#​33075](https://github.com/nuxt/nuxt/pull/33075))
- **nuxt:** Lazy hydration macros without auto-imports ([#​33037](https://github.com/nuxt/nuxt/pull/33037))
- **kit,nuxt,schema:** Allow modules to specify dependencies ([#​33063](https://github.com/nuxt/nuxt/pull/33063))
- **kit,nuxt:** Add `getLayerDirectories` util and refactor to use it ([#​33098](https://github.com/nuxt/nuxt/pull/33098))
##### 🔥 Performance
- **nuxt:** Clear inline route rules cache when pages change ([#​32877](https://github.com/nuxt/nuxt/pull/32877))
- **nuxt:** Stop watching app manifest once a change has been detected ([#​32880](https://github.com/nuxt/nuxt/pull/32880))
##### 🩹 Fixes
- **nuxt:** Handle `satisfies` in page augmentation ([#​32902](https://github.com/nuxt/nuxt/pull/32902))
- **nuxt:** Type response in `useFetch` hooks ([#​32891](https://github.com/nuxt/nuxt/pull/32891))
- **nuxt:** Add TS parenthesis and as expression for page meta extraction ([#​32914](https://github.com/nuxt/nuxt/pull/32914))
- **nuxt:** Use correct unit thresholds for relative time ([#​32893](https://github.com/nuxt/nuxt/pull/32893))
- **nuxt:** Handle uncached current build manifests ([#​32913](https://github.com/nuxt/nuxt/pull/32913))
- **kit:** Resolve directories in `resolvePath` and normalize file extensions ([#​32857](https://github.com/nuxt/nuxt/pull/32857))
- **schema,vite:** Bump `requestTimeout` + allow configuration ([#​32874](https://github.com/nuxt/nuxt/pull/32874))
- **nuxt:** Deep merge extracted route meta ([#​32887](https://github.com/nuxt/nuxt/pull/32887))
- **nuxt:** Do not expose app components until fully resolved ([#​32993](https://github.com/nuxt/nuxt/pull/32993))
- **kit:** Only exclude `node_modules/` if no custom `srcDir` ([#​32987](https://github.com/nuxt/nuxt/pull/32987))
- **nuxt:** Transform ts before page meta extraction ([#​32920](https://github.com/nuxt/nuxt/pull/32920))
- **nuxt:** Compare final matched routes when syncing `route` object ([#​32899](https://github.com/nuxt/nuxt/pull/32899))
- **nuxt:** Make vue server warnings much less verbose in dev mode ([#​33018](https://github.com/nuxt/nuxt/pull/33018))
- **schema:** Allow disabling cssnano/autoprefixer postcss plugins ([#​33016](https://github.com/nuxt/nuxt/pull/33016))
- **kit:** Ensure local layers are prioritised alphabetically ([#​33030](https://github.com/nuxt/nuxt/pull/33030))
- **kit,nuxt:** Expose global types to vue compiler ([#​33026](https://github.com/nuxt/nuxt/pull/33026))
- **deps:** Bump devalue ([#​33072](https://github.com/nuxt/nuxt/pull/33072))
- **nuxt:** Support config type inference for `defineNuxtModule().with()` ([#​33081](https://github.com/nuxt/nuxt/pull/33081))
- **nuxt:** Search for colliding names in route children ([b58c139d2](https://github.com/nuxt/nuxt/commit/b58c139d2))
- **nuxt:** Delete `nuxtApp._runningTransition` on resolve ([#​33025](https://github.com/nuxt/nuxt/pull/33025))
- **nuxt:** Add validation for nuxt island reviver key ([#​33069](https://github.com/nuxt/nuxt/pull/33069))
##### 💅 Refactors
- **nuxt:** Simplify page segment parsing ([#​32901](https://github.com/nuxt/nuxt/pull/32901))
- **nuxt:** Remove unnecessary `async/await` in `afterEach` ([#​32999](https://github.com/nuxt/nuxt/pull/32999))
- **vite:** Simplify inline chunk iteration ([6f4da1b8c](https://github.com/nuxt/nuxt/commit/6f4da1b8c))
- **kit,nuxt,ui-templates,vite:** Address deprecations + improve regexp perf ([#​33093](https://github.com/nuxt/nuxt/pull/33093))
##### 📖 Documentation
- Switch example to use vitest projects ([#​32863](https://github.com/nuxt/nuxt/pull/32863))
- Update testing `setupTimeout` and add `teardownTimeout` ([#​32868](https://github.com/nuxt/nuxt/pull/32868))
- Update `webRoot` to use new app directory ([df7177bff](https://github.com/nuxt/nuxt/commit/df7177bff))
- Add middleware to layers guide ([6fc25ff79](https://github.com/nuxt/nuxt/commit/6fc25ff79))
- Use `app/` directory in layer guide ([eee55ea41](https://github.com/nuxt/nuxt/commit/eee55ea41))
- Add documentation for `--nightly` command ([#​32907](https://github.com/nuxt/nuxt/pull/32907))
- Update package information in roadmap section ([#​32881](https://github.com/nuxt/nuxt/pull/32881))
- Add more info about nuxt spa loader element attributes ([#​32871](https://github.com/nuxt/nuxt/pull/32871))
- Update `features.inlineStyles` default value ([6ff3fbebb](https://github.com/nuxt/nuxt/commit/6ff3fbebb))
- Correct filename in example ([#​33000](https://github.com/nuxt/nuxt/pull/33000))
- Add more information about using `useRoute` and accessing route in middleware ([#​33004](https://github.com/nuxt/nuxt/pull/33004))
- Avoid variable shadowing in locale example ([#​33031](https://github.com/nuxt/nuxt/pull/33031))
- Add documentation for module lifecycle hooks ([#​33115](https://github.com/nuxt/nuxt/pull/33115))
##### 🏡 Chore
- **config:** Migrate renovate config ([#​32861](https://github.com/nuxt/nuxt/pull/32861))
- Remove stray test file ([ca84285cc](https://github.com/nuxt/nuxt/commit/ca84285cc))
- Ignore webpagetest.org when scanning links ([6c974f0be](https://github.com/nuxt/nuxt/commit/6c974f0be))
- Add `type: 'module'` in playground ([#​33099](https://github.com/nuxt/nuxt/pull/33099))
##### ✅ Tests
- Add failing test for link component duplication ([#​32792](https://github.com/nuxt/nuxt/pull/32792))
- Simplify module hook tests ([#​32950](https://github.com/nuxt/nuxt/pull/32950))
- Refactor stubbing of `import.meta.dev` ([#​33023](https://github.com/nuxt/nuxt/pull/33023))
- Use `findWorkspaceDir` rather than relative paths to repo root ([a6dec5bd9](https://github.com/nuxt/nuxt/commit/a6dec5bd9))
- Improve router test for global transitions ([5d783662c](https://github.com/nuxt/nuxt/commit/5d783662c))
- Use `expect.poll` ([53fb61d5d](https://github.com/nuxt/nuxt/commit/53fb61d5d))
- Use `expect.poll` instead of `expectWithPolling` ([357492ca7](https://github.com/nuxt/nuxt/commit/357492ca7))
- Use `vi.waitUntil` instead of custom retry logic ([611e66a47](https://github.com/nuxt/nuxt/commit/611e66a47))
##### 🤖 CI
- Remove double set of tests for docs prs ([6bc9dccf4](https://github.com/nuxt/nuxt/commit/6bc9dccf4))
- Add workflow for discord team discussion threads ([bc656a24d](https://github.com/nuxt/nuxt/commit/bc656a24d))
- Fix some syntax issues with discord + github integrations ([f5f01b8c1](https://github.com/nuxt/nuxt/commit/f5f01b8c1))
- Use token for adding issue to project ([66afbe0a2](https://github.com/nuxt/nuxt/commit/66afbe0a2))
- Use discord bot to create thread automatically ([618a3cd40](https://github.com/nuxt/nuxt/commit/618a3cd40))
- Only use discord bot ([bfd30d8ce](https://github.com/nuxt/nuxt/commit/bfd30d8ce))
- Update format of discord message ([eb79a2f07](https://github.com/nuxt/nuxt/commit/eb79a2f07))
- Try bolding entire line ([c66124d7b](https://github.com/nuxt/nuxt/commit/c66124d7b))
- Oops ([38644b933](https://github.com/nuxt/nuxt/commit/38644b933))
- Add delay after adding each reaction ([ecb49019f](https://github.com/nuxt/nuxt/commit/ecb49019f))
- Use last lts node version for testing ([e06e37d02](https://github.com/nuxt/nuxt/commit/e06e37d02))
- Try npm trusted publisher ([85f1e05eb](https://github.com/nuxt/nuxt/commit/85f1e05eb))
- Use npm trusted publisher for main releases ([abf5d9e9f](https://github.com/nuxt/nuxt/commit/abf5d9e9f))
- Change wording ([#​32979](https://github.com/nuxt/nuxt/pull/32979))
- Add github ai moderator ([#​33077](https://github.com/nuxt/nuxt/pull/33077))
##### ❤️ Contributors
- Daniel Roe ([@​danielroe](https://github.com/danielroe))
- abeer0 ([@​iiio2](https://github.com/iiio2))
- Julien Huang ([@​huang-julien](https://github.com/huang-julien))
- kyumoon ([@​kyumoon](https://github.com/kyumoon))
- Alexander Lichter ([@​TheAlexLichter](https://github.com/TheAlexLichter))
- Bobbie Goede ([@​BobbieGoede](https://github.com/BobbieGoede))
- Rich Harris ([@​Rich-Harris](https://github.com/Rich-Harris))
- mustafa60x ([@​mustafa60x](https://github.com/mustafa60x))
- Matej Černý ([@​cernymatej](https://github.com/cernymatej))
- Alex Liu ([@​Mini-ghost](https://github.com/Mini-ghost))
- Amitav Chris Mostafa ([@​semibroiled](https://github.com/semibroiled))
- Romain Hamel ([@​romhml](https://github.com/romhml))
- Jacky Lam ([@​jackylamhk](https://github.com/jackylamhk))
- Mukund Shah ([@​mukundshah](https://github.com/mukundshah))
- Luke Nelson ([@​luc122c](https://github.com/luc122c))
- letianpailove ([@​letianpailove](https://github.com/letianpailove))
- Erwan Jugand ([@​erwanjugand](https://github.com/erwanjugand))
- Alexander ([@​TheColorman](https://github.com/TheColorman))
- Ryota Watanabe ([@​wattanx](https://github.com/wattanx))
- Yizack Rangel ([@​Yizack](https://github.com/Yizack))
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.
🔕 **Ignore**: Close this MR and you won't be reminded about this update again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box
---
This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45My4zIiwidXBkYXRlZEluVmVyIjoiNDEuOTMuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
This MR contains the following updates:
4.0.3->4.1.0Release Notes
nuxt/nuxt (nuxt)
v4.1.0Compare Source
👀 Highlights
🔥 Build and Performance Improvements
🍫 Enhanced Chunk Stability
Build stability has been significantly improved with import maps (#33075). This prevents cascading hash changes that could invalidate large portions of your build when small changes are made:
By default, JS chunks emitted in a Vite build are hashed, which means they can be cached immutably. However, this can cause a significant issue: a change to a single component can cause every hash to be invalidated, massively increasing the chance of 404s.
In short:
Obviously this wasn't optimal. With this new feature, the hash of (otherwise) unchanged files which import the entry won't be affected.
This feature is automatically enabled and helps maintain better cache efficiency in production. It does require native import map support, but Nuxt will automatically disable it if you have configured
vite.build.targetto include a browser that doesn't support import maps.And of course you can disable it if needed:
🦀 Experimental Rolldown Support
Nuxt now includes experimental support for
rolldown-vite(#31812), bringing Rust-powered bundling for potentially faster builds.To try Rolldown in your Nuxt project, you need to override Vite with the rolldown-powered version since Vite is a dependency of Nuxt. Add the following to your
package.json:npm:
pnpm:
yarn:
bun:
After adding the override, reinstall your dependencies. Nuxt will automatically detect when Rolldown is available and adjust its build configuration accordingly.
For more details on Rolldown integration, see the Vite Rolldown guide.
🧪 Improved Lazy Hydration
Lazy hydration macros now work without auto-imports (#33037), making them more reliable when component auto-discovery is disabled:
This ensures that components that are not "discovered" through Nuxt (e.g., because
componentsis set tofalsein the config) can still be used in lazy hydration macros.📄 Enhanced Page Rules
If you have enabled experimental extraction of route rules, these are now exposed on a dedicated
rulesproperty onNuxtPageobjects (#32897), making them more accessible to modules and improving the overall architecture:The
defineRouteRulesfunction continues to work exactly as before, but now provides better integration possibilities for modules.🚀 Module Development Enhancements
Module Dependencies and Integration
Modules can now specify dependencies and modify options for other modules (#33063). This enables better module integration and ensures proper setup order:
This replaces the deprecated
installModulefunction and provides a more robust way to handle module dependencies with version constraints and configuration merging.🪝 Module Lifecycle Hooks
Module authors now have access to two new lifecycle hooks:
onInstallandonUpgrade(#32397). These hooks allow modules to perform additional setup steps when first installed or when upgraded to a new version:The hooks are only triggered when both
nameandversionare provided in the module metadata. Nuxt uses the.nuxtrcfile internally to track module versions and trigger the appropriate hooks. (If you haven't come across it before, the.nuxtrcfile should be committed to version control.)🙈 Enhanced File Resolution
The new
ignoreoption forresolveFiles(#32858) allows module authors to exclude specific files based on glob patterns:📂 Layer Directories Utility
A new
getLayerDirectoriesutility (#33098) provides a clean interface for accessing layer directories without directly accessing private APIs:✨ Developer Experience Improvements
🎱 Simplified Kit Utilities
Several kit utilities have been improved for better developer experience:
addServerImportsnow supports single imports (#32289):🔥 Performance Optimizations
This release includes several internal performance optimizations:
🐛 Notable Fixes
useFetchhook typing (#32891)<NuxtTime>(#32893)✅ Upgrading
As usual, 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
ignoreoption toresolveFiles(#32858)onInstallandonUpgrademodule hooks (#32397)rolldown-vite(#31812)defineRouteRulesto pagerulesproperty (#32897)getLayerDirectoriesutil and refactor to use it (#33098)🔥 Performance
🩹 Fixes
satisfiesin page augmentation (#32902)useFetchhooks (#32891)resolvePathand normalize file extensions (#32857)requestTimeout+ allow configuration (#32874)node_modules/if no customsrcDir(#32987)routeobject (#32899)defineNuxtModule().with()(#33081)nuxtApp._runningTransitionon resolve (#33025)💅 Refactors
async/awaitinafterEach(#32999)📖 Documentation
setupTimeoutand addteardownTimeout(#32868)webRootto use new app directory (df7177bff)app/directory in layer guide (eee55ea41)--nightlycommand (#32907)features.inlineStylesdefault value (6ff3fbebb)useRouteand accessing route in middleware (#33004)🏡 Chore
type: 'module'in playground (#33099)✅ Tests
import.meta.dev(#33023)findWorkspaceDirrather than relative paths to repo root (a6dec5bd9)expect.poll(53fb61d5d)expect.pollinstead ofexpectWithPolling(357492ca7)vi.waitUntilinstead of custom retry logic (611e66a47)🤖 CI
❤️ Contributors
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this MR and you won't be reminded about this update again.
This MR has been generated by Renovate Bot.
mentioned in issue #49
added 2 commits
4c6d90b5- 1 commit from branchmaind4a7ffe3- chore(deps): update dependency nuxt to v4.1.0Compare with previous version