Skip to content
Discussion options

You must be logged in to vote

vite doesn't watch files outside project root by default (docs directory in this case). You'll need to do something like this:

// docs/.vitepress/config.mts

import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitepress'

export default defineConfig({
  vite: {
    plugins: [
      {
        name: 'custom:watch-outside',
        configureServer(server) {
          server.watcher.add(fileURLToPath(new URL('../../src', import.meta.url)))
          // or maybe just server.watcher.add(process.cwd())
        }
      }
    ]
  }
})

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@brc-dd
Comment options

Answer selected by ISOR3X
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants