3.3.0 is a minor (feature) release with lots of new features to play with. 3.3.1 was a swiftly following release to patch an issue with nuxi on Windows.
👀 Highlights
✨ Local module development DX
We've landed a raft of changes to enable local modules and improve DX. We now auto-scan your ~/modules
folder and register top level files there as modules in your project (#19394). When these files are changed, we'll automatically restart the nuxt server.
export default defineNuxtConfig({
modules: [
'@nuxtjs/tailwindcss',
- '~/modules/purge-comments'
]
})
We also now expose nuxt/kit
for easy access to kit composables in your local project without having to install @nuxt/kit
(#19422).
♻️ Restarting Nuxt
You can add files to the watch
array to automatically restart the server (#19530). This is likely to be particularly useful for module authors. You can also trigger a restart of the Nuxt server with the new restart
hook (#19084). We also landed a couple of fixes on restarting the Nuxt server which should improve your experience when developing.
🔥 Performance improvements
We've increased static asset maxAge to 1yr as a matter of best practice (#19335), and support tree-shaking more of your build (#19508). We also now support preloading <NuxtLink>
s with a route in object-syntax (#19120).
We also track how long it takes each module you use to perform its setup, and warn if it takes too long. You can see all these values by running your dev server with DEBUG=1
You can also opt-in to some of Nuxt's internal optimisations by configuring composables to be treeshaken in a particular environment (#19383), or to have magic keys automatically injected (#19490) - primarily useful for module authors.
🐛 Error handling
We now handle chunk errors by default (#19086), meaning if your site updates with a redeploy, we automatically handle reloading it on navigation. You can disable this and handle it yourself with the new reloadNuxtApp
composable. You can also set experimental.restoreState
to preserve some of your app state across reloads.
We also have a new experimental error handling component: <NuxtClientFallback>
(nuxt/framework#8216) which can capture errors rendering on server, replace them with fallback content, and granularly trigger rerendering the part with an error on the client. This can be enabled with experimental.clientFallback
- feedback very welcome!
⚡️ Head improvements
We've migrated to use unhead
directly (#19519) - and automatically tree-shake server-only head composables like useServerHead
from your client build (#19576), meaning you can have great SEO without needing to include meta tag logic that's relevant only for crawlers in your client build.
There's also a new useHeadSafe
composable that handles santising untrusted user input (#19548).
🪵 Better logging in browser DevTools
Working with the Chrome DevTools team, we've landed a couple of features across the unjs + Nuxt ecosystem meaning we now have first-class support for hiding Nuxt internal stack traces from logs in your (Chromium-based, for now) browser (#19243). We also landed a couple of improvements with stacktraces involving Nuxt hooks (unjs/hookable#69 and unjs/hookable#68) implementing console.createTask
.
Before | After |
---|---|
💪 Type improvements
Types for server API routes are now more correct - with non-serialisable types stripped out of the return type (unjs/nitro#1002).
We also now type more of NuxtApp
and correctly type unknown injections for greater type-safety (#19643).
And if you were struggling with correct types when using transform
+ default
with Nuxt data fetching composables, fear no more - we now infer the types correctly (#19487).
⚗️ Nitro enhancements
This release comes with Nitro v2.3, which brings lots of improvements of its own. Check out the release for more info.
We now support useAppConfig
in nitro server routes (#19489) - a long-awaited change. Now useAppConfig
is consistently available throughout your app for non-runtime configuration from layers, modules, etc.
We've also added a nitro:build:public-assets
hook to allow modifying assets output from nitro's prerender/build phase (https://github.com/nuxt/nuxt/pull/196380.
🛠️ Build changes
As part of moving towards first-class support for PNP and pnpm support without --shamefully-hoist
, we've dropped support for some internal (deprecated) utilities using CJS resolve patterns (#19537, #19608). We also now resolve dependencies like nuxt
, @nuxt/kit
and more using ESM search-paths. We'll be keeping a close eye on this.
We're also preparing the groundwork for support of new TypeScript Node16 module resolution (#19606), and as part of this have changed the format of our runtime output (using .js
instead of .mjs
extensions, providing types
fields for subpath exports, and more).
🗺️ Custom config schema (advanced)
We've been testing out an experimental feature to allow modules and users to extend the Nuxt config schema (#15592), and we've now enabled this by default (#19172). We expect this will be particularly useful for module and layer/theme authors, and should result in some nicer DX for their users.
Changelog
🚀 Enhancements
- nuxi: Enforce consistent casing in filenames (#19088)
- nuxi: Reload nuxt when
restart
hook is called (#19084) - nuxt: Scan composables with star export (#19249)
- nuxt: Add
versions
to runtime nuxtApp (#19064) - vite: Add
node_modules
and buildDir tox_google_ignoreList
(#19243) - nuxi: Cli wrapper for self restart (#18641)
- schema: Allow adding page routes without a matching file (#19173)
- nuxt: Add support for
nuxt/kit
subpath for local use (#19422) - nuxt: Auto-register modules in
~/modules
(#19394) - nuxt: Enable config schema by default (#19172)
- kit,nuxt: Add component
priority
to allow overriding (#19252) - nuxt: Enable preloading object-syntax routes (#19120)
- nuxt: Support
trailingSlashBehavior
indefineNuxtLink
(#19458) - nuxt: Allow configuring treeshakeable composables (#19383)
- nuxi,schema: Add support for setting nuxt
logLevel
(#19369) - nuxt: Support custom keyed composables (#19490)
- nuxi: Programmatically pass nuxt config overrides (to dev) (#19371)
- vite: Use custom logger to show vite logs (#19523)
- nuxt: Enable chunk error handling by default (#19086)
- nuxt: Add
<NuxtClientFallback>
component (#8216) - nuxt: Add
watch
option and refactor dev server restarting (#19530) - nuxt: Add
useHeadSafe
and remove layer around head imports (#19548) - kit, schema: Measure module setup timings (#18648)
- nuxt: Support app config for server routes (#19489)
- nuxt: Add
nitro:build:public-assets
hook (#19638)
🔥 Performance
- nuxt: Increase static asset maxAge to 1yr (#19335)
- vite: Mark more core functions as side-effect free (#19508)
- nuxt: Drop
@vueuse/head
dependency (#19519) - nuxt: Tree-shake server composables + prefer server head (#19576)
🩹 Fixes
- nuxt: Clear loading indicator on unmount (#19340)
- nuxt: Deprecate scanning directory index plugins (#18418)
- nuxt: Prevent fallthrough attributes on custom
NuxtLink
(#19379) - schema: Update vite
import.meta
types (#19338) - vite: Omit
/
fromsourcemapIgnoreList
for windows support (73ade185b) - nuxt: Pass transform options to component loader plugin (#19414)
- nuxi: Avoid top-level await in wrapper (44068420d)
- nuxt: Add
kit.*
files to published package (#19430) - nuxt: Don't print layout warning if page is not ssr (#19434)
- kit: Match commit hashes of other lengths (#19450)
- nuxi: Handle different kind of shutdown signals (#19485)
- nuxt: Exclude nitro output dir from type checking (#19532)
- vite: Allow disabling clear screen behaviour (#19531)
- nuxt: Only log boot errors on client-side (#19553)
- nuxt: Dedupe payload cache by payload url (#19563)
- nuxt: Provide node16-style type exports (#18431)
- nuxt: Avoid injecting adhoc modules in schema (#19607)
- nuxt: Improve types for data fetching with
transform
(#19487) - nuxi: Resolve kit from nuxt modules dir (#19601)
- nuxt,schema: Merge custom and resolved app configs (#19602)
- nuxt: Resolve builder using esm syntax (#19608)
- nuxt: Exclude
boolean
from inline module definitions (#19621) - schema: Show
payloadExtraction
warning only when unset (#18516) - nuxt: Mark non-augmented NuxtApp properties as unknown (#19643)
- nuxt: Fix default injection type for plugins (#19669)
💅 Refactors
- nuxi: Hard restart with communication channel (#19423)
- kit,nuxi: Resolve module paths using node algorithm (#19537)
- nuxt: Let mlly handle search paths (#19635)
📖 Documentation
- Use consistent indentation in examples (#19342)
- Update esm link (c35104c76)
- Add frontmatter note for docs readme to remove from live preview (008426cd3)
- Add edge banners on
versions
and modules (#19448) - Add local modules ordering (5977adb4d)
- Fix link to nitro
routeRules
(#19455) - Fix dead link to useSeoMeta guide (#19463)
- Update
devServer.https
example (#19486) - Add info
~/server/utils
directory in~/utils
page (#19500) - Update
addComponent
jsdoc comment (#19503) - Update cli docs for
--log-level
(06b9233b1) - Update pr template to include jsdoc annotations (#19511)
- Add new release cycle info (#19509)
- Fix local modules (c4222b1f6)
- Update nitro plugins url (#19547)
- Ui components - pinceau migration (#19533)
- Update $fetch documentation (#19356)
- Move prerequisites into a summary (e0cb950f0)
- Remove note since already in code block for pnpm (d67a873c4)
- Add nuxt 2 to nuxt 3 workshop (2905282de)
- Update various nitro links (#19562)
- Use consistent page name in example (#19583)
- Add missing backquotes (#19590)
- Remove reference to beta/rc/coming soon (4ad5c959e)
- Warn about modules with side-effects (#19592)
- Mention config file name before code block (#19634)
🏡 Chore
- Bump edge version based on commits (#19397)
- Add branch to edge release script (171288586)
- Add chore to type of change in pr template (#19420)
- Mark
@nuxt/test-utils
package as external group (#19419) - Restrict commit hash strings to 8 chars (abcd27ae0)
- deps: ⚠️ Update dependency fork-ts-checker-webpack-plugin to v8 (main) (#19468)
- Force minor bumps at most (0b82f6751)
- nuxt: Update to new
hasProtocol
options format (#19555) - Improve internal type safety (#19599)
- Refresh lockfile (#19653)
- Constrain nitro to minor version (88a5f38de)
- Bump package versions (615750614)
✅ Tests
- Close pages after use (#19558)
🤖 CI
- Limit nuxt2 nightly build to nuxt org (#19352)
- Fetch git history (e11d55a49)
- Lint workflows (#19556)
- Move typecheck to build step (99cda4f38)
- Stub before typecheck (f92fedc8e)
- Rename step (34875bc0e)
⚠️ Breaking Changes
- deps: ⚠️ Update dependency fork-ts-checker-webpack-plugin to v8 (main) (#19468)
❤️ Contributors
- Daniel Roe daniel@roe.dev
- Pooya Parsa pyapar@gmail.com
- Joff Tiquez (@jofftiquez)
- Hyunseung Lee (@hslee2008)
- Xin Du (Clark) clark.duxin@gmail.com
- Julien Huang julien.huang@outlook.fr
- Harlan Wilton (@harlan-zw)
- Lei (@oizhaolei)
- 江麻妞 jiangmaniu@qq.com
- Sébastien Chopin (@Atinux)
- Özüm Eldoğan (@ozum)
- Florent Delerue florentdelerue@hotmail.com
- S96EA neild47@163.com
- Mehmet (@productdevbook)
- Anthony Fu anthonyfu117@hotmail.com
- Sebastian Landwehr (@dword-design)
- Clément Ollivier (@clemcode)
- Jakub Andrzejewski (@Baroshem)
- Paulius Varna paul.varna@gmail.com
- Alex Korytskyi (@alex-key)
- Samuel DIDIER-LAURENT
- Alex Liu (@Mini-ghost)
- Alexander Lichter (@manniL)
- Horu
- Ivan rebyatyonok@yandex.com
- Stefan stefan.heim@hotmail.com
- Lucie
- Inesh Bose
- Mahdi Shah Abbasian (@shahabbasian)