v3.2.0
版本发布时间: 2023-02-09 19:06:29
nuxt/nuxt最新发布版本:v3.14.1592(2024-11-20 04:54:11)
3.2.0 is the first minor release since we've started our new release schedule. We've brought it forward by a couple of weeks to include some goodies we want you to be able to play with soon.
👀 Highlights
-
⚡️ Nuxt DevTools
You can opt-in to Nuxt DevTools per-project by going to the project root and running:
npx nuxi@latest devtools enable
Restart your Nuxt server and open your app in browser. Click the Nuxt icon on the bottom (or press
Alt+D
) to toggle the DevTools.More information in the docs!
-
✨ Better DX for overriding
runtimeConfig
, including inline type helpers -
🪄 Automatically inferred return type for
useFetch
and$fetch
based on method.It'll be a type error to use the wrong method when hitting an endpoint.
Plus, if you have multiple methods served by a single endpoint (like
~/server/api/test.get.ts
and~/server/api/test.post.ts
then the response type will match the kind of response you make. -
🍪
useFetch
is now integrated withevent.$fetch
, meaning cookies and context are now passed to api requests automagically within internal requests. -
🔥 We now treeshake client-only components out of the server build more effectively using the experimental
treeshakeClientOnly
featureThis is turned on by default but if you experience any issues, you can turn this off via:
export default defineNuxtConfig({ experimental: { treeshakeClientOnly: false } })
-
🛠️ New
addRouteMiddleware
kit utility for module authors -
💪 Nitropack v2.2 has been released
Lots of features, including runtime proxy support using route rules, nested fetch calls, binary and raw storage operations, exposed
event.context.cf
(cloudflare) and built-in session support.For full details see release notes
Changelog
🚀 Enhancements
-
kit: Add
addRouteMiddleware
method (#18553) -
cli: Warn when prerendering routes with
ssr: false
(#18783) - schema: Add type hints for runtime config (#18652)
- nuxt: Support type auto-import (#18859)
-
nuxt: Infer
useFetch
return based on the method (#18526) - cli: Add initial support for enabling/disabling devtools (#18864)
- nuxt: Upgrade to nitropack 2.2 (#18889)
🔥 Performance
-
vite: Use stub entry in vite server build when
ssr: false
(#18782)
🩹 Fixes
- nuxt: Treeshake client-only components with placeholders (#8789)
-
webpack: Client-side typechecking when
ssr: false
(#18828) - vite: Exclude styles, not all assets (#18752)
- nuxt: Defer adding route path to preloaded record (#18862)
- nuxt: Don't exclude pnpm layers from nitro esbuild/imports (#9952)
-
nuxt: Use parser to treeshake
<ClientOnly>
(#8713) - Reorder the types field in package.json (#18880)
💅 Refactors
- nuxt: Within nuxt app, import directly from source file (#18902)
📖 Documentation
- Remove extra word (#18750)
- example: Fix app config link (#18760)
- Add
useError
composable (#8912) - Clarify augmenting input/output app config (#8953)
- Add explanation of composable lifecycle (#8116)
- typescript: Type-checking guide (#18768)
- schema: Add NuxtHooks interface documentation (#18756)
- Resolve
preloadRouteComponents
page heading error (#18804) - Update to nuxt 2.16.0 in bridge installation (#18836)
- Add link to vue hydration mismatch docs (#18842)
- Update auto-imports for the server part (#18848)
- Warn about slots in server components (#18854)
- Add explanation with augmented meta for new routes (#18901)
✅ Tests
- Decrease vite logging during tests (5426e5609)
❤️ Contributors
- Daniel Roe daniel@roe.dev
- Pooya Parsa pyapar@gmail.com
- Chen
- Julien Huang julien.huang@outlook.fr
- Yasser Lahbibi yasser.lahbibi@apenhet.com
- Dany Sluijk me@dany.dev
- Alex Liu dsa1314@gmail.com
- Anthony Fu anthonyfu117@hotmail.com
- Ayaka Rizumu rizumu@oqo.moe
- Alexander Lichter github@lichter.io
- Sébastien Chopin seb@nuxt.com
- Mehdi HosseinZade arshen@outlook.com
- Yesid
- Lucas lucasdraichi@gmail.com
- Joseph Ojoko tjoe4u@gmail.com
- Dago
- Krutie Patel krutie.patel@gmail.com
- Leigh lawleycobhc@gmail.com