Skip to content

Commit c339bfd

Browse files
authored
fix: adopt forward-compatible approach to builder:watch (#24)
1 parent 8ab6635 commit c339bfd

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { relative, resolve } from 'node:path'
12
import { existsSync } from 'node:fs'
23
import type { NuxtModule } from 'nuxt/schema'
34
import { addComponentsDir, addImports, addPlugin, addServerHandler, addServerImports, addServerPlugin, createResolver, defineNuxtModule } from '@nuxt/kit'
@@ -317,6 +318,7 @@ const nuxtModule = defineNuxtModule<ModuleOptions>({
317318
nuxt.options.watch.push(`${queriesDir}/*`)
318319

319320
nuxt.hook('builder:watch', async (event, path) => {
321+
path = relative(nuxt.options.srcDir, resolve(nuxt.options.srcDir, path))
320322
if (event === 'add' || event === 'change' || event === 'unlink' || event === 'unlinkDir') {
321323
// Queries
322324
if (path.includes(options.queriesDir) && path.endsWith('.edgeql')) {

0 commit comments

Comments
 (0)