Skip to content

Nuxt

The Nuxt plugin gives every package with a Nuxt config a build, dev and preview task, so a repository of Nuxt apps builds, caches and serves them without a script for each.

Terminal window
axle add nuxt

This writes it into the root axle.toml:

[plugins.nuxt]
source = "npm:@axle-rs/plugin-nuxt@0.1.0"
hash = "sha256-…"

A package or project with a nuxt.config file, .ts, .mts, .cts, .js, .mjs or .cjs, in its folder gets:

Task Command Settings
build nuxt build outputs .output and .nuxt
dev nuxt dev persistent, ready when Nuxt prints its Local: address
preview nuxt preview persistent, after the build

Each command runs through the repository’s package manager, such as pnpm exec nuxt build, so it uses the version the package installs.

.output is the server and the public files Nuxt builds, and .nuxt the code it generates. A config that moves them, with buildDir or Nitro’s output, should set outputs for build in the package’s axle.toml.

A package’s own script wins. When its package.json has a script with a task’s name that runs something else, such as "dev": "nuxi dev --tunnel", the plugin leaves that task alone and Axle runs the script. A script that only runs Nuxt the way the plugin would, through nuxt or nuxi, is replaced by the plugin’s task, which runs the same command and adds its settings. The repository’s axle.toml changes a task as it would any other, and wins over the plugin.

Setting Default Meaning
build "build" the name of the build task, or false to leave it out
dev "dev" the name of the dev server task, or false
preview "preview" the name of the preview task, or false
[plugins.nuxt]
source = "npm:@axle-rs/plugin-nuxt@0.1.0"
hash = "sha256-…"
preview = false

The plugin’s answers are kept until a nuxt.config.*, a package.json, pnpm-workspace.yaml or a lockfile changes.