Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,13 @@ export default defineNuxtModule<GqlConfig>({

if (config.watch) {
nuxt.hook('builder:watch', async (event, path) => {
if (!path.match(/\.(gql|graphql)$/)) { return }
// Ignore paths with `../` for nuxt layers & non gql files
if (!path.match(/\.(gql|graphql)$/) || path.match(/^\.\.\//)) { return }

if (event !== 'unlink' && !allowDocument(path)) { return }
// Ignore schema files & `unlink` events
if ((event !== 'unlink' && !allowDocument(path)) || (event === 'unlink')) { return }

// Start Codegen Generation
const start = Date.now()
await generateGqlTypes(path)
await nuxt.callHook('builder:generateApp')
Expand Down