Skip to content

Commit

Permalink
fix: adopt forward-compatible approach to builder:watch (#476)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Apr 3, 2024
1 parent ec3c6bd commit cf8dfca
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/module.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { relative, resolve } from 'node:path'
import { existsSync, statSync } from 'fs'
import { defu } from 'defu'
import { upperFirst } from 'scule'
Expand Down Expand Up @@ -285,6 +286,7 @@ export default defineNuxtModule<GqlConfig>({

if (config.watch) {
nuxt.hook('builder:watch', async (event, path) => {
path = relative(nuxt.options.srcDir, resolve(nuxt.options.srcDir, path))
if (!path.match(/\.(gql|graphql)$/)) { return }

if (event !== 'unlink' && !allowDocument(path)) { return }
Expand Down

0 comments on commit cf8dfca

Please sign in to comment.