watch

Content Watcher

Purpose

Control content watching

export default defineNuxtConfig({
  content: {
    watch: process.env.DISABLE_CONTENT_WATCH === 'true' ? false : {
      ws: { port: 5555, // WebSocket }
    }
  }
})

WebSocket is a communication protocol that uses real-time, bi-directional communications over a single TCP connection between server and client software.

The WebSocket Server allows the Nuxt dev server to push updates to the browser, (on content, config or code change) without requiring a page reload.

When styling or working on other aspects that do not require latest /content source versions, disable watching before launching dev server:

DISABLE_CONTENT_WATCH=true pnpm dev

This watch config is specific to @Nuxt/content and differs from the watch property in Nuxt config.

Copyright @ 2024 Anne Brown