News & Announcements

Using Netlify’s platform primitives is easier than ever with Nuxt 4

Nuxt logo in nice design treatment

Nuxt 4 hasn’t yet been released, but we’re already excited to announce that Netlify will have full support for all upcoming new Nuxt features, improvements, and breaking changes on Day 1. Keep reading to find out what’s changed, how the Nuxt on Netlify experience has gotten a serious upgrade, and how you can opt in early.

How to try Nuxt 4 before it’s released

Like many frameworks these days, Nuxt incrementally makes breaking changes available to users via opt-in options, long before a major version is released.

You can opt your Nuxt 3 site into “Nuxt 4” by setting future.compatibilityVersion: 4 in your Nuxt config file or even opt into individual breaking changes as you see fit.

To opt into all the Netlify improvements described below, you’ll also need to set your Nuxt compatibility date to 2024-05-07 or later (we recommend setting this to the current day):

export default defineNuxtConfig({
  compatibilityDate: "2024-11-13",
  future: { compatibilityVersion: 4 },
});

What’s new in Nuxt 4

One of the most notable changes is the new default directory structure that moves most top-level directories into an app/ directory, allowing for a clearer delineation of browser vs. server concerns, improved dev server performance, and even improved type safety. As with Next.js pages/ and app/ directory structures, Nuxt 4 will support both the new and old structures, so this isn’t a breaking change.

There are also minor changes to fetching and caching behaviors that you should read before upgrading. Check out this guide or the official upgrade guide for thorough reviews.

What’s new on Netlify in Nuxt 4

Netlify is a zero-config deployment target for Nuxt apps. In Nuxt 4, we’ve rewritten Netlify support from the ground up to make better use of our platform primitives.

As a result, Nuxt sites on Netlify have gotten a big upgrade.

Use the platform

Under the hood, Nuxt sites on Netlify will now use the latest Netlify Functions API. This doesn’t change much on its own, but it unlocks the following improvements:

To find out more about how to leverage Netlify’s powerful caching primitives with Nuxt 4, check out this new in-depth guide, published today jointly with this post.

Note: All the above applies to the netlify deployment preset, which is the default on Netlify. If you’ve opted in to the netlify-edge preset, none of the above has changed.

Fewer function invocations

Known static paths will now return a 404 immediately without invoking a function, even for specific files that aren’t present in the published deploy. This can be a big deal on high-traffic sites because users’ browsers may be frequently requesting fingerprinted assets from previous deploys (e.g. requesting /_nuxt/AbCdefgh.js when the latest deploy contains /_nuxt/ijkLMno.js).

A high-traffic enterprise customer we opted into this feature saw an 11% reduction in their serverless function invocations.

Upgrade existing applications

The Nuxt team has partnered with Codemod to make migrating your existing sites as seamless as possible. In most cases, you just run a command.

Then, follow the steps above to opt into the Netlify improvements early.

Deploy a Nuxt 4 application on Netlify

If you don’t have an application and want to get started today, click the button above and follow the prompts.

You can also follow Nuxt’s getting started docs to create a new project, push it to GitHub or your preferred git provider, then deploy it automatically or manually with the Netlify CLI.

In all cases, Nuxt’s Nitro engine automatically detects the Netlify environment and configures and builds your site accordingly.

Keep reading

Recent posts

How do the best dev and marketing teams work together?