content icon indicating copy to clipboard operation
content copied to clipboard

Custom content collection do not hot-reload

Open jeannen opened this issue 3 months ago • 9 comments

Environment

Version

v3

Reproduction

Create an empty Nuxt content project, and create a new collection

doc: defineCollection({
            type: 'page',
            source: 'docs/install-short/**/*.md',
            schema: z.object({
                title: z.string(),
                description: z.string(),
                language: z.enum(['html', 'nuxt', 'react']),
                icon: z.string().optional(),
                enabled: z.boolean().optional(),
            }),
        }),

Description

Whenever a custom collection is used, the markdown hot-reload does not work anymore

The file change is detected (File docs/install-short/1.html.md changed on content collection ) but the dev server does not update, and need to be restarted to see the changes

Additional context

No response

Logs


jeannen avatar Aug 22 '25 10:08 jeannen

A full upgrade to the new nuxt 4.0.3 Version fixed the described issue, which was introduced in my project, while updating packages. That's the reason why I wanted to upgrade to nuxt 4.0.3. I had some problems with other nuxt modules, but now, after the upgrade is fully completed (changing directory structure etc., like Upgrade Guide tells to), my last test before writing this comment, shows, that it now hot-reload changes to the markdown files.

------------------------------
- Operating System: Linux
- Node Version:     v24.6.0
- Nuxt Version:     4.0.3
- CLI Version:      3.28.0
- Nitro Version:    2.12.4
- Package Manager:  [email protected]
- Builder:          -
- User Config:      devtools, app, appConfig, compatibilityDate, debug, dev, sourcemap, ssr, routeRules, css, postcss, experimental, modules, hooks, site, sitemap, i18n, icon, ogImage, nitro, router, content
- Runtime Modules:  @nuxtjs/[email protected], @nuxtjs/[email protected], @nuxtjs/[email protected], @vueuse/[email protected], [email protected], [email protected], [email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxtjs/[email protected]
- Build Modules:    -
------------------------------

Mastercuber avatar Aug 24 '25 07:08 Mastercuber

A full upgrade to the new nuxt 4.0.3 Version fixed the described issue, which was introduced in my project, while updating packages. That's the reason why I wanted to upgrade to nuxt 4.0.3. I had some problems with other nuxt modules, but now, after the upgrade is fully completed (changing directory structure etc., like Upgrade Guide tells to), my last test before writing this comment, shows, that it now hot-reload changes to the markdown files.

------------------------------
- Operating System: Linux
- Node Version:     v24.6.0
- Nuxt Version:     4.0.3
- CLI Version:      3.28.0
- Nitro Version:    2.12.4
- Package Manager:  [email protected]
- Builder:          -
- User Config:      devtools, app, appConfig, compatibilityDate, debug, dev, sourcemap, ssr, routeRules, css, postcss, experimental, modules, hooks, site, sitemap, i18n, icon, ogImage, nitro, router, content
- Runtime Modules:  @nuxtjs/[email protected], @nuxtjs/[email protected], @nuxtjs/[email protected], @vueuse/[email protected], [email protected], [email protected], [email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxtjs/[email protected]
- Build Modules:    -
------------------------------

I already uses 4.0.3 :/

jeannen avatar Aug 28 '25 00:08 jeannen

@jeannen Could you prove a reproduction project? A simple git repo or online on StackBlitz?

farnabaz avatar Sep 05 '25 12:09 farnabaz

I can give you access to one of my repo if needed (but it's really just a new Nuxt Content project with a few posts tho, and got the same issue on all my other Nuxt Content projects)

@jeannen Could you prove a reproduction project? A simple git repo or online on StackBlitz?

jeannen avatar Sep 11 '25 01:09 jeannen

Same here

ahoiroman avatar Sep 12 '25 22:09 ahoiroman

I can't remember what exactly fixed it for me, but maybe one of these could help:

export default defineNuxtConfig({
  hooks: {
    'vite:configResolved'(config) {
      // Enforce again on the fully resolved Vite config (final safeguard)
      if (config.server) {
        const srv = config.server as unknown as { watch?: Record<string, unknown> };
        srv.watch = srv.watch || {};
        (srv.watch as any).ignored = ['**/node_modules/**', '**/.git/**'];
      }
    }
  }
})

or

export default defineNuxtConfig({
  experimental: {
    payloadExtraction: true,
    watcher: 'chokidar'
  },
})
------------------------------
- Operating System: Linux
- Node Version:     v24.7.0
- Nuxt Version:     4.1.2
- CLI Version:      3.28.0
- Nitro Version:    2.12.6
- Package Manager:  [email protected]
- Builder:          -
- User Config:      devtools, app, appConfig, compatibilityDate, debug, dev, sourcemap, ssr, routeRules, css, postcss, experimental, modules, schemaOrg, hooks, site, sitemap, components, i18n, icon, ogImage, runtimeConfig, nitro, router, content                                                                                                                       
- Runtime Modules:  @nuxtjs/[email protected], @nuxtjs/[email protected], @nuxtjs/[email protected], @vueuse/[email protected], [email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxtjs/[email protected]                                                             
- Build Modules:    -
------------------------------

For me, it still works in (now) 4.1.2.

Hope this helps.

Mastercuber avatar Sep 16 '25 04:09 Mastercuber

@Mastercuber neither option worked for me. Using npm with nuxt content v3.8.1 and nuxt v4.2.1. Only when I touch nuxt config while the local server is running does my one of my nuxt content pages refresh. Otherwise, I have to restart the server.

djmtype avatar Nov 13 '25 18:11 djmtype

Still experiencing the issue

jeannen avatar Nov 25 '25 06:11 jeannen

Using Nuxt 4.2.1, Nuxt Content 3.8.2, with bun 1.3.2 has seemed work for me so far. Whereas, old versions of Nuxt Content 3.8.1 with bun 1.3.1 did not.

djmtype avatar Nov 25 '25 14:11 djmtype