Repository: nuxt/nuxt
Pull request #31175: feat(kit,nuxt): resolve template imports from originating module
Author: login: danielroe
Labels: name: ✨ enhancement
description: New feature or improvement to existing functionality
name: 3.x
Created: 2025-03-01T11:09:34Z | Merged: 2025-03-01T12:37:07Z

### 🔗 Linked issue

<!-- Please ensure there is an open issue and mention its number. For example, "resolves #123" -->

### 📚 Description

this adds a fast-path return for when we can resolve a module from the path that called `addTemplate` or `addPluginTemplate`, which allows different major versions of certain libraries used in templates (e.g. `ohash` to coexist simultaneously).

if you experience any issues, you can disable it with:

```ts
export default defineNuxtConfig({
  experimental: {
    templateImportResolution: false
  }
})
```

Linked issue #123: What is the best way to load json.
I have a json file with data to initialise my pages. I put it in `/static` folder e.g. `/static/data.json`. Then I use `axios.get()` to load it from `/data.json`. That works on the client, but fails on the server. 

I have these questions, which I think will be very useful for wider audience as well:
1. What is wrong with the example below?
2. Is `/static` the best place to put data files?
3. is loading them via axios the best way ?
4. What if I want to load from 3 different locations for server, for client and for static build? 


```js
 export default {
    data({ req, params, store }) {
      
      return axios.get('/data.json')
        .then((res) => {
          return {
            authors: res.data
          }
        })
    }
  }
```

Thanks in advance
Linked issue comments: user: login: SkaterDad
created_at: 2017-01-11T23:32:54Z
body: Is this a file you will be changing often on the fly?   

If this configuration can be baked into the builds, another option could be to import the JSON file in the components that need it, utilizing Webpack's JSON loader?  Or convert it to a JS module and export the values. 
author_association: NONE
user: login: atinux
created_at: 2017-01-12T18:46:02Z
body: Hi @husayt 

To answer your questions:

## What is wrong with the example below?

When the http call is made from the server, axios has no idea that you're on http://localhost:3000, so it can't call the route `/data.json`. You have to give the full url.

It can be made by setting a `baseURL` variable in the `env` of your `nuxt.config.js`:

```js
// nuxt.config.js
module.exports = {
  env: {
    baseURL: (process.env.NODE_ENV === 'production' ? 'http//your-url' : 'http://localhost:3000')
  }
}
```

Then in you data method:

```js
async asyncData({ req, params, store }) {
  const authors = await axios.get(process.env.baseURL + '/data.json').then(res => res.data)

  return { authors }
  })
}
```

**I recommend to use the [axios module](https://axios.nuxtjs.org/) to avoid giving a `baseUrl` environment key.**

## Is `static/` the best place to put data files?

If you want to access them via an http call, it's a good place yes.

## Is loading them via `axios` the best way ?

Not really since from the server-side, you will have to make an HTTP call, which is not the best for performances.

So you can load the file from the server-side using `fs.readFile` to solve this (and also avoid to set the baseURL in the nuxt.config.js):

```js
async asyncData({ req, isServer, params, store }) {
  const data = {}

  if (process.server) {
    data.authors = JSON.parse(require('fs').readFileSync('../static/data.json', 'utf8'))
  } else {
    data.authors = await axios.get('/data.json').then(res => res.data)
  }

  return { authors }
}
```

Furthermore, if your data does not change often (and I guess it does not if it's in the static folder), then importing the file via Webpack is **a great solution** (credits to @SkaterDad for pointing it out).

```html
<script>
import authors from '~/static/data.json'

export default {
  asyncData ({ params }) {
    return { authors }
  }
}
</script>
```

The other advantage of using Webpack is that you don't have to expose this data in the `static/` folder, you can have a `data` folder an do `import authors from '~/data/authors.json'`

Another advantage, is that you can use the code-splitting feature to avoid putting the `data.json` inside the page bundle and load it asynchronously on the client-side (so it could be cached separately):

```html
<script>
const getAuthors = () => import('~/data/authors.json').then(m => m.default || m)

export default {
  async asyncData ({ req }) {
    const authors = await getAuthors()

    return { authors }
  }
}
</script>
```

The only disadvantage of using webpack is that `data.json` is linked to your bundle. In development there is no problem since Webpack will listen on the file and re-bundle everytime `data.json` changes. But in production, if you're changing the data file directly on your server, you will have to run `nuxt build` manually to reflect the changes.

## What if I want to load from 3 different locations for server, for client and for static build?

I'm not sure to understand the question, but all the code example I wrote works for all of them :)
author_association: MEMBER
user: login: husayt
created_at: 2017-01-15T19:27:50Z
body: @Atinux thanks for very detailed reply. This will be very useful addition to FAQ page.

We covered the following data file reading patterns:
1) to ajax download resources from both server/client (with axios) via baseurl, based on environment
2) read local files on server side via `fs.readFile`
3) import with webpack

There might be even more patterns.


So all is cool with running it in dev mode. Now I hit two problems running from static generated files (after `generate` completed).
1) the data is embedded in `window.___NUXT___` variable in the html and I would prefer it to be loaded from external file
2) When I open the page I can see all the information from the file ( basically list of names), but then in two seconds the list disappears. I have been trying to debug to catch what event is causing it, but maybe you are aware of something like that.

Thanks
author_association: CONTRIBUTOR
user: login: atinux
created_at: 2017-01-16T11:15:19Z
body: @husayt 

The data embedded in `window.__NUXT__` is required to hydrate the application before mounting it, this cannot be loaded from an external file.

For your error you're experiencing, can you provide me some code samples so I can reproduce this behaviour on my setup?
author_association: MEMBER
user: login: husayt
created_at: 2017-01-21T00:24:17Z
body: Hi @Atinux, thanks for detailed reply.

As for disappearing data here is the screen gif, showing that data disappears few seconds after loading.

![sozler](https://cloud.githubusercontent.com/assets/1169324/22169855/70c8b3a4-df6f-11e6-8b71-e0cb9370f9f8.gif)


Here is the code:
```js
<template>
  <section class="container">
  
    <h1 class="title">    {{title}}</h1>
    <li v-for="author in authors">
      <nuxt-link :to="{ name: 'authors-id', params: { id: author.id } }">{{ author.text }}</nuxt-link>
    </li>
  </section>
  
</template>

<script>
  import {axiosGet} from '~plugins/util'

  export default {
    data({ env,req,params,store}) {
     return axiosGet(env.baseURL +'rest/authors.json')
        .then((res) => {
          return {
            authors: res.data,
            title: 'Müəlliflər'
          }
        })
    },
    head() {
      return {
        title: this.title
      }
    },
  }
</script>
```
author_association: CONTRIBUTOR
user: login: patrickrodee
created_at: 2017-02-22T00:34:32Z
body: @husayt I've encountered the exact same issue. It appears to be an issue with Vue's vdom throwing a mismatch of the server rendered DOM and the virtual DOM. I've encountered it with homegrown Vue SSR and Nuxt. If the Nuxt team can get a fix, that'd be dope.
author_association: NONE
user: login: NateTheGreatt
created_at: 2017-03-27T14:20:20Z
body: @husayt I'm not sure if this is causing your issue, but you have invalid HTML in your template. Your `<li>` tag needs to be wrapped in a `<ul>` tag. Hopefully that will fix the problem.
author_association: NONE
user: login: maxschulmeister
created_at: 2017-04-09T19:08:49Z
body: is there a proper way to automatically webpack assets such as images that are defined in a json file?
author_association: NONE
user: login: heishung
created_at: 2017-10-02T04:54:59Z
body: hi i need help i'm try trans  variable {{location.slug}} in nuxt-link , 

 `<nuxt-link :to="{ name: 'location', params: { slug: location.slug} }">
              <img alt="" src="~/assets/public/orchidcruise-cabins-suites.png" width="100%">
                <div class="product-title has-text-centered">
                  <span class="text">{{location.name}}</span>
                </div></nuxt-link>`

author_association: NONE
user: login: lock[bot]
created_at: 2018-11-05T10:08:12Z
body: This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

author_association: NONE

Diff:
diff --git a/packages/kit/src/template.ts b/packages/kit/src/template.ts
index b635702a80f3..f803cdd92987 100644
--- a/packages/kit/src/template.ts
+++ b/packages/kit/src/template.ts
@@ -1,5 +1,6 @@
 import { existsSync, promises as fsp } from 'node:fs'
-import { basename, isAbsolute, join, parse, relative, resolve } from 'pathe'
+import { fileURLToPath } from 'node:url'
+import { basename, isAbsolute, join, normalize, parse, relative, resolve } from 'pathe'
 import { hash } from 'ohash'
 import type { Nuxt, NuxtServerTemplate, NuxtTemplate, NuxtTypeTemplate, ResolvedNuxtTemplate, TSReference } from '@nuxt/schema'
 import { withTrailingSlash } from 'ufo'
@@ -8,8 +9,9 @@ import type { TSConfig } from 'pkg-types'
 import { gte } from 'semver'
 import { readPackageJSON } from 'pkg-types'
 import { resolveModulePath } from 'exsolve'
+import { captureStackTrace } from 'errx'
 
-import { filterInPlace } from './utils'
+import { distDirURL, filterInPlace } from './utils'
 import { directoryToURL } from './internal/esm'
 import { getDirectory } from './module/install'
 import { tryUseNuxt, useNuxt } from './context'
@@ -27,6 +29,19 @@ export function addTemplate<T> (_template: NuxtTemplate<T> | string) {
   // Remove any existing template with the same destination path
   filterInPlace(nuxt.options.build.templates, p => normalizeTemplate(p).dst !== template.dst)
 
+  try {
+    const distDir = distDirURL.toString()
+    const { source } = captureStackTrace().find(e => e.source && !e.source.startsWith(distDir)) ?? {}
+    if (source) {
+      const path = normalize(fileURLToPath(source))
+      if (existsSync(path)) {
+        template._path = path
+      }
+    }
+  } catch {
+    // ignore errors as this is an additive feature
+  }
+
   // Add to templates array
   nuxt.options.build.templates.push(template)
 
diff --git a/packages/kit/src/utils.ts b/packages/kit/src/utils.ts
index 0816bcf5cdc0..e675b46e2383 100644
--- a/packages/kit/src/utils.ts
+++ b/packages/kit/src/utils.ts
@@ -19,3 +19,5 @@ export function filterInPlace<T> (array: T[], predicate: (item: T, index: number
 }
 
 export const MODE_RE = /\.(server|client)(\.\w+)*$/
+
+export const distDirURL = new URL('.', import.meta.url)
diff --git a/packages/nuxt/src/core/plugins/resolve-deep-imports.ts b/packages/nuxt/src/core/plugins/resolve-deep-imports.ts
index 01734c9c776d..949573559d1d 100644
--- a/packages/nuxt/src/core/plugins/resolve-deep-imports.ts
+++ b/packages/nuxt/src/core/plugins/resolve-deep-imports.ts
@@ -1,6 +1,6 @@
 import { parseNodeModulePath } from 'mlly'
 import { resolveModulePath } from 'exsolve'
-import { isAbsolute, normalize } from 'pathe'
+import { isAbsolute, normalize, resolve } from 'pathe'
 import type { Plugin } from 'vite'
 import { directoryToURL, resolveAlias } from '@nuxt/kit'
 import type { Nuxt } from '@nuxt/schema'
@@ -8,6 +8,8 @@ import type { Nuxt } from '@nuxt/schema'
 import { pkgDir } from '../../dirs'
 import { logger } from '../../utils'
 
+const VIRTUAL_RE = /^\0?virtual:(?:nuxt:)?/
+
 export function resolveDeepImportsPlugin (nuxt: Nuxt): Plugin {
   const exclude: string[] = ['virtual:', '\0virtual:', '/__skip_vite', '@vitest/']
   let conditions: string[]
@@ -29,12 +31,24 @@ export function resolveDeepImportsPlugin (nuxt: Nuxt): Plugin {
       conditions = [...resolvedConditions]
     },
     async resolveId (id, importer) {
-      if (!importer || isAbsolute(id) || (!isAbsolute(importer) && !importer.startsWith('virtual:') && !importer.startsWith('\0virtual:')) || exclude.some(e => id.startsWith(e))) {
+      if (!importer || isAbsolute(id) || (!isAbsolute(importer) && !VIRTUAL_RE.test(importer)) || exclude.some(e => id.startsWith(e))) {
         return
       }
 
       const normalisedId = resolveAlias(normalize(id), nuxt.options.alias)
-      const normalisedImporter = importer.replace(/^\0?virtual:(?:nuxt:)?/, '')
+      const isNuxtTemplate = importer.startsWith('virtual:nuxt')
+      const normalisedImporter = (isNuxtTemplate ? decodeURIComponent(importer) : importer).replace(VIRTUAL_RE, '')
+
+      if (nuxt.options.experimental.templateImportResolution !== false && isNuxtTemplate) {
+        const template = nuxt.options.build.templates.find(t => resolve(nuxt.options.buildDir, t.filename!) === normalisedImporter)
+        if (template?._path) {
+          const res = await this.resolve?.(normalisedId, template._path, { skipSelf: true })
+          if (res !== undefined && res !== null) {
+            return res
+          }
+        }
+      }
+
       const dir = parseNodeModulePath(normalisedImporter).dir || pkgDir
 
       const res = await this.resolve?.(normalisedId, dir, { skipSelf: true })
diff --git a/packages/schema/src/config/experimental.ts b/packages/schema/src/config/experimental.ts
index ce3238a89db4..aef9df1d2877 100644
--- a/packages/schema/src/config/experimental.ts
+++ b/packages/schema/src/config/experimental.ts
@@ -487,5 +487,10 @@ export default defineResolvers({
         return typeof val === 'boolean' ? val : true
       },
     },
+
+    /**
+     * Disable resolving imports into Nuxt templates from the path of the module that added the template.
+     */
+    templateImportResolution: true,
   },
 })
diff --git a/packages/schema/src/types/nuxt.ts b/packages/schema/src/types/nuxt.ts
index ed95dd685106..18368b13ca1d 100644
--- a/packages/schema/src/types/nuxt.ts
+++ b/packages/schema/src/types/nuxt.ts
@@ -43,6 +43,11 @@ export interface NuxtTemplate<Options = TemplateDefaultOptions> {
   getContents?: (data: { nuxt: Nuxt, app: NuxtApp, options: Options }) => string | Promise<string>
   /** Write to filesystem */
   write?: boolean
+  /**
+   * The source path of the template (to try resolving dependencies from).
+   * @internal
+   */
+  _path?: string
 }
 
 export interface NuxtServerTemplate {


Reviews:
user: login: pi0
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-01T11:19:35Z
user: login: pi0
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-01T11:21:05Z
user: login: danielroe
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-01T12:12:22Z

Review comments:
diff_hunk: @@ -27,6 +29,18 @@ export function addTemplate<T> (_template: NuxtTemplate<T> | string) {
   // Remove any existing template with the same destination path
   filterInPlace(nuxt.options.build.templates, p => normalizeTemplate(p).dst !== template.dst)
 
+  try {
+    const { source } = captureStackTrace().find(e => e.source && !e.source.startsWith('file://' + distDir)) ?? {}
+    if (source) {
+      const path = fileURLToPath(source)
+      if (existsSync(path)) {
+        template._path = path
path: packages/kit/src/template.ts
user: login: pi0
body: just precaution here windows paths are not normalized (some rollup plugins with resolve hook might have strange issues -- at least we might have double caching issues wit same path w slash/backslash)
created_at: 2025-03-01T11:19:35Z
author_association: MEMBER
diff_hunk: @@ -27,6 +29,18 @@ export function addTemplate<T> (_template: NuxtTemplate<T> | string) {
   // Remove any existing template with the same destination path
   filterInPlace(nuxt.options.build.templates, p => normalizeTemplate(p).dst !== template.dst)
 
+  try {
+    const { source } = captureStackTrace().find(e => e.source && !e.source.startsWith('file://' + distDir)) ?? {}
path: packages/kit/src/template.ts
user: login: pi0
body: Since we are using url comparation, wondering if would be better to use `distDirURL` (and avoid `fileURLToPath` which is also platform dependent in utils.ts)
created_at: 2025-03-01T11:21:05Z
author_association: MEMBER
diff_hunk: @@ -1,3 +1,5 @@
+import { fileURLToPath } from 'node:url'
path: packages/kit/src/utils.ts
user: login: danielroe
body: ```suggestion
```

created_at: 2025-03-01T12:12:09Z
author_association: MEMBER
diff_hunk: @@ -1,3 +1,5 @@
+import { fileURLToPath } from 'node:url'
+
path: packages/kit/src/utils.ts
user: login: danielroe
body: ```suggestion
```

created_at: 2025-03-01T12:12:17Z
author_association: MEMBER

PR comments:
user: login: bolt-new-by-stackblitz[bot]
created_at: 2025-03-01T11:09:37Z
body: <a href="https://stackblitz.com/~/github.com/nuxt/nuxt/pull/31175"><img src="https://developer.stackblitz.com/img/review_pr_small.svg" alt="Review PR in StackBlitz Codeflow" align="left" width="103" height="20"></a> _Run & review this pull request in [StackBlitz Codeflow](https://stackblitz.com/~/github.com/nuxt/nuxt/pull/31175)._

author_association: NONE
user: login: coderabbitai[bot]
created_at: 2025-03-01T11:10:52Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- This is an auto-generated comment: rate limited by coderabbit.ai -->

> [!WARNING]
> ## Rate limit exceeded
> 
> @danielroe has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait **11 minutes and 19 seconds** before requesting another review.
> 
> <details>
> <summary>⌛ How to resolve this issue?</summary>
> 
> After the wait time has elapsed, a review can be triggered using the `@coderabbitai review` command as a PR comment. Alternatively, push new commits to this PR.
> 
> We recommend that you space out your commits to avoid hitting the rate limit.
> 
> </details>
> 
> 
> <details>
> <summary>🚦 How do rate limits work?</summary>
> 
> CodeRabbit enforces hourly rate limits for each developer per organization.
> 
> Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
> 
> Please see our [FAQ](https://docs.coderabbit.ai/faq) for further information.
> 
> </details>
> 
> <details>
> <summary>📥 Commits</summary>
> 
> Reviewing files that changed from the base of the PR and between be4026670d286807c60d294c6e7517530794a3bd and 2dd407f55af166945047a802b8e01913d2c44063.
> 
> </details>
> 
> <details>
> <summary>📒 Files selected for processing (1)</summary>
> 
> * `packages/kit/src/utils.ts` (1 hunks)
> 
> </details>

<!-- end of auto-generated comment: rate limited by coderabbit.ai -->
<!-- walkthrough_start -->

## Walkthrough

The pull request introduces several modifications across different modules concerning template handling and module resolution. A try-catch block has been added in the `addTemplate` function to capture the call stack and determine the originating file for a template. This involves utilising Node's URL tools and a stack trace capturing utility, along with an existence check for the determined file path. In the utilities module, a new constant `distDirURL` converts the current module URL to a file path. Changes in the module resolution plugin include a new regular expression `VIRTUAL_RE` to detect virtual module paths and conditional logic for handling Nuxt templates based on an experimental configuration option `templateImportResolution`. Additionally, an optional property `_path` has been added to the `NuxtTemplate` interface to store the source path of the template for internal tracking purposes.

<!-- walkthrough_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOY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lYrjxsY4L1k57ikzoIsB2SjceBWh0zgJ9RfF9lJ5FksAUsQyd4bd614jGIWQsQQDlzN9KA1zDgTgaYnduR9NVg/QuU+EeBVQ4FcRC9xgiMuRdpF9N5/8v0BoxV+glBXJWE6JEycSfSq9YVIC3iBS/QhSSlehxVylUA0zLyWJmE+BqRKBh9qJjSNwZxu8PsidLUhE5NGQMLGhEzLQ2BFVaB5sK4Dy1SjzKATzPALS4lUwlA/Sg4tDvNdCTVQzzVwzgsyzozzC4zotrCkyoArAVzMLM1vUNycQIjNxScRjcKKAOL9QWKa4RjEjo0azGc6y51ZBByUiViOyKsLYrZqZLk6YGZRsJy2Z1ZCgtYdYpyDYAFjY1BTYJY7KpY3L1BvEjhEBvEAg3xkM6BvEOcwgKYDBgqABOAAJjQDQAABY3gBB7gRcSBkr7hDoXgGBMqXgAAOe4AQN4cqhgZKkXBgAANkyoYHKpUCUHeHuFSvuHNkMGCruEypF1SsasapeBF1oFSvKsavKpFxKsavGtSuSpasapIHeARjypeCWrQCqvoESuCrVlCvCsipIGiotNoG8Rpl6qAA== -->

<!-- internal state end -->
<!-- tips_start -->

---

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: CONTRIBUTOR
user: login: pkg-pr-new[bot]
created_at: 2025-03-01T11:23:25Z
body: 
[Open in Stackblitz](https://pkg.pr.new/template/da75f5ed-e4e7-4739-b79a-b7e7e026001a)


<details><summary><b>@nuxt/kit</b></summary><p>

```
npm i https://pkg.pr.new/@nuxt/kit@31175
```

</p></details>
      
    

<details><summary><b>nuxt</b></summary><p>

```
npm i https://pkg.pr.new/nuxt@31175
```

</p></details>
      
    

<details><summary><b>@nuxt/rspack-builder</b></summary><p>

```
npm i https://pkg.pr.new/@nuxt/rspack-builder@31175
```

</p></details>
      
    

<details><summary><b>@nuxt/schema</b></summary><p>

```
npm i https://pkg.pr.new/@nuxt/schema@31175
```

</p></details>
      
    

<details><summary><b>@nuxt/vite-builder</b></summary><p>

```
npm i https://pkg.pr.new/@nuxt/vite-builder@31175
```

</p></details>
      
    

<details><summary><b>@nuxt/webpack-builder</b></summary><p>

```
npm i https://pkg.pr.new/@nuxt/webpack-builder@31175
```

</p></details>
      
    

_commit: <a href="https://github.com/nuxt/nuxt/runs/38034774466"><code>2dd407f</code></a>_

author_association: NONE
user: login: codspeed-hq[bot]
created_at: 2025-03-01T11:37:35Z
body: <!-- __CODSPEED_PERFORMANCE_REPORT_COMMENT__ -->
<!-- __CODSPEED_INSTRUMENTATION_PERFORMANCE_REPORT_COMMENT__ -->

## [CodSpeed Performance Report](https://codspeed.io/nuxt/nuxt/branches/feat%2Ftemplate-resolution)

### Merging #31175 will **not alter performance**

<sub>Comparing <code>feat/template-resolution</code> (2dd407f) with <code>main</code> (98b8c93)</sub>



### Summary

`✅ 10` untouched benchmarks  




author_association: NONE