Skip to content

v3.6.0

Compare
Choose a tag to compare
@danielroe danielroe released this 23 Jun 12:22
· 1650 commits to main since this release
e58cfc8

3.6.0 is the next minor release, packed with improvements and bug fixes.

📣 Upcoming news

In the coming week you can expect two announcements:

  1. The open-sourcing of nuxt/cli by @pi0 - a new, drop-in replacement for nuxi featuring more extensibility and better DX. We are aiming to release this alongside Nuxt 3.7, but you would be very welcome to test and contribute to nuxi-ng before then!
  2. Three significant RFCs: Nuxt Font, Nuxt Assets and Nuxt Scripts. We're expecting an initial POC to take shape in the next month, and would very much appreciate community feedback on this.

👀 Highlights

This minor release contains quite a lot, and we have big plans

 SPA loading indicator

If your site is served with ssr: false or you have disabled server-rendering on some of your pages, you might be particularly interested in the new built-in SPA loading indicator.

You can now place an HTML file in ~/app/spa-loading-template.html with some HTML you would like to use to render a loading screen that will be rendered until your app is hydrated on these pages.

👉 By default an animated Nuxt icon is rendered. You can completely disable this indicator by setting spaLoadingTemplate: false in your nuxt configuration file.

⚡️ Performance improvements

The first thing that happens when your app is hydrated is that your plugins run, and so we now perform build-time optimisations on your plugins, meaning they do not need to be normalised or reordered at runtime.

We also include your error component JS in your main entrypoint, meaning that if an error occurs when a user has no connectivity, you can still handle it with your ~/error.vue. (This also should decrease your total bundle size.)

👉 Compared to Nuxt 3.5.3, the minimal client bundle has decreased by ~0.7kB. Let's keep this up!

🔥 Fully static server components

It has been possible to use server components on static pages, but until now they would increase the payload size of your application. That is no longer true. We now store rendered server components as separate files, which are preloaded before navigation.

👉 This does rely on the new, richer JSON payload format, so make sure you have not disabled this by setting experimental.renderJsonPayloads to false.

🎨 Better style inlining

If you're monitoring your metrics closely and have not turned off experimental.inlineSSRStyles, you should see more CSS inlined in your page, and a significantly external CSS file. We're now better at deduplicating global CSS, particularly added by libraries like tailwind or unocss.

🎬 Animation controls

To give you more fine-grained control over your page/layout components, for example to create custom transitions with GSAP or other libraries, we now allow you to set pageRef on <NuxtPage> and layoutRef on <NuxtLayout. These will get passed through to the underlying DOM elements.

✨ Automatic 'static' preset detection

Up to now, running nuxt generate produced the same output on every deployment provider, but with Nuxt 3.6 we now enable static provider presets automatically. That means if you are deploying a static build (produced with nuxt generate) to a supported provider (currently vercel and netlify with cloudflare and github pages coming soon) we'll prerender your pages with special support for that provider.

This means we can configure any route rules (redirects/headers/etc) that do not require a server function. So you should get the best of both worlds when deploying a site that doesn't require runtime SSR. It also unblocks use of Nuxt Image on Vercel (with more potential for automatic provider integration coming soon).

💪 Increased type safety

We now have better support for server-specific #imports and augmentations if you are using the new ~/server/tsconfig.json we shipped in Nuxt 3.5. So when importing from #imports in your server directory, you'll get IDE auto-completion for the right import locations in Nitro, and won't see Vue auto-imports like useFetch that are unavailable within your server routes.

You should now also have type support for runtime Nitro hooks.

Finally, we have removed more locations where objects had a default any type. This should improve type safety within Nuxt in a number of locations where unspecified types fell back to any:

  • RuntimeConfig
  • PageMeta
  • NuxtApp['payload'] (accessible now from NuxtPayload interface)
  • ModuleMeta

You can find out more about how to update your code if this affects you in the original PR.

⚗️ Nitro 2.5 built-in

This release ships with new Nitro 2.5, which has a whole list of exciting improvements that are worth checking out.

Of particular note is experimental support for streaming, which is also enabled by a couple of changes in Nuxt itself.

🛠️ New tools for module authors

This release brings a number of utilities for modules authors to easily add type templates and assert compatibility with a given version of another module.

In addition, this release will finally unlock a new nuxt/module-builder mode that should improve type support for module authors. If you're a module author, you might consider following these migration steps to try it out in the coming days.

✅ Upgrading

As usual, our recommendation for upgrading is to run:

nuxi upgrade --force

This will refresh your lockfile as well, and ensures that you pull in updates from other dependencies that Nuxt relies on, particularly in the unjs ecosystem.

👉 Changelog

compare changes

🚀 Enhancements

  • nuxt: Sync useCookie state between tabs (#20970)
  • kit: Module compatibility utils (#21246)
  • nuxt: Add renderResult to app:rendered (#18610)
  • webpack: Allow configuring esbuild-loader options (#21436)
  • nuxt: Add open option in navigateTo helper (#21333)
  • webpack, schema: Add webpack experiments configuration (#21446)
  • nuxt: Provide clearNuxtState composable (#21409)
  • kit: addTypeTemplate helper with auto-registration (#21331)
  • nuxt: Return status from useAsyncData (#21045)
  • nuxt: Allow accessing NuxtPage ref via pageRef (#19403)
  • nuxt: Allow accessing NuxtLayout ref via layoutRef (#19465)
  • nuxt: Emit error in ssr-error event (#21547)
  • nuxt: Start loading indicator state with middleware (#21003)
  • kit: Allow direct function in defineNuxtModule (#20763)
  • nuxt: Expose useNuxtApp to window for convenience (#21636)
  • nuxt: Allow configuring spa loading indicator (#21640)
  • nuxt: Add types for nuxt-defined nitro runtime hooks (#21666)
  • nuxt: Update devdependency nitropack to v2.5.1 (#21696)

🔥 Performance

  • nuxt: Mark define functions as side-effect free at source (#21434)
  • nuxt: Import error component synchronously (#21406)
  • nuxt: Use prerendered islands to serialise/revive payload (#21461)
  • nuxt: Extract and apply plugin order at build time (#21611)

🩹 Fixes

  • nuxt: Handle page rendering on different path (#21408)
  • nuxt: Replace BigInt literal with BigInt constructor (#21427)
  • vite: Remove resolveId workaround and update vite-node (#21423)
  • schema: Remove obsolete terser option from webpack config (#21407)
  • nuxt: Skip vue render when redirecting (#21412)
  • nuxt: Avoid early returning renderer with empty response (#21439)
  • nuxt: Add missing vue types (#21445)
  • nuxt: Prefix server component ids to avoid collisions (#21472)
  • schema: Add more explicit types for config schema (#21475)
  • nuxt: Fix typo on nitro.autoImport option (#21485)
  • nuxi,nuxt: Remove baseUrl + use relative paths in tsconfig (#21081)
  • vite: Invalidate templates by dst not src (#21501)
  • nuxt: Don't disable vue endpoint in dev mode (#21524)
  • nuxt: Respect query/hash for external routes in navigateTo (#21500)
  • nuxt: Abort navigation when updating window.location (#21521)
  • vite: Ignore and warn if vite config file exists (#21588)
  • nuxt: Ensure prerendered components are treated as islands (#21583)
  • nuxt: Improve warning for invalid children of <Title> (#21613)
  • nuxt: Replace : in rendered server components (for win) (#21645)
  • cli: Add back default baseUrl in tsconfig.json (#21632)
  • nuxt: Post non-proxied cookie value via BroadcastChannel (#21653)
  • nuxt: Stop indicator when not changing page component (#21656)
  • nuxt: Scroll to top in nested routes (#21657)
  • nuxt: Inline css directly in root component (#21573)
  • nuxt: Move to @typescript-eslint/typescript-estree (#21664)
  • nuxt: Guard res.end() calls with check if event is handled (#21665)
  • nuxt: Do not embed error path in payload (#21671)
  • nuxt: Use static nitro build if possible (#21655)
  • nuxt: Add aliases and augmentations for nitro context (#21680)
  • nuxt,schema: Prefer unknown rather than any for signatures (#21700)
  • schema: Change redirect type for NuxtPage type (#21713)
  • nuxt: Fix error on layout switching (#21450)

📖 Documentation

  • Add info about vue configuration (#21303)
  • Include example for server utilities (#21337)
  • Improved recommended gitignore list (#21451)
  • Add info about merging strategy in app config (#21462)
  • Avoid using render when defining rendering (#21490)
  • Remove example of deprecated reactivity transform (#21396)
  • Fix addTypeTemplate typos (#21520)
  • Add warning about redirect check (#20680)
  • Remove link to closed RFC (#21564)
  • Info icon fix on "Standalone server" section (#21589)
  • Add note to use nuxt with bridge if nitro is false (#21586)
  • Add styling section (#21525)
  • Add full stop (#21614)
  • Reorder sfc blocks and add initial slash in link (#21618)
  • Add info on extending the HTML template (#21615)
  • Document parallel option on plugins (#21622)
  • Americanize spelling + fix typos (#21627)
  • Remove examples/ from repository (#21538)
  • examples: Add bullet points (9df892a17)
  • Add experimental features page (#21617)
  • Fix typo in experimental features (#21663)
  • Update specified Nuxt 2 version in migration guide (#21699)
  • Added @latest to install commands (#21702)

🏡 Chore

  • Add vitest renovate group (7695aca93)
  • Add full version for octokit/request-action (dd5955caf)
  • Widen peer deps in renovate updates (b0ba4b864)
  • Bump bundle size 🤔 (ce4f46385)
  • Ignore webpack-dev-middleware updates on 2.x branch (7f7ae96d1)
  • Ignore vercel/netlify build directories (5d4b71426)

✅ Tests

  • Update bundle size (08df73801)
  • Skip instance error test in vite ecosystem CI (f97052cba)

🤖 CI

  • Move bundle skipping logic to workflow (#21448)
  • Build project before calculating bundle size (ce096da96)

❤️ Contributors