|
| 1 | +diff --git a/playground/nitro.config.ts b/playground/nitro.config.ts |
| 2 | +index 824d7a8..69b15ea 100644 |
| 3 | +--- a/playground/nitro.config.ts |
| 4 | ++++ b/playground/nitro.config.ts |
| 5 | +@@ -4,27 +4,6 @@ export default defineNitroConfig({ |
| 6 | + srcDir: 'server', |
| 7 | + modules: ['nitro-graphql-yoga'], |
| 8 | + compatibilityDate: '2025-07-01', |
| 9 | +- hooks: { |
| 10 | +- 'nitro:build:before': (nitro) => { |
| 11 | +- // Ensure rollupConfig exists |
| 12 | +- nitro.options.rollupConfig = nitro.options.rollupConfig || {} |
| 13 | +- nitro.options.rollupConfig.output = nitro.options.rollupConfig.output || {} |
| 14 | +- |
| 15 | +- // Configure manual chunks for GraphQL files |
| 16 | +- nitro.options.rollupConfig.output.manualChunks = (id) => { |
| 17 | +- if (id.includes('/graphql/') || id.includes('resolver') || id.includes('createUser') || id.includes('hello') || id.includes('posts') || id.includes('todos') || id.includes('users') || id.includes('comment-resolver')) { |
| 18 | +- return 'graphql' |
| 19 | +- } |
| 20 | +- return undefined |
| 21 | +- } |
| 22 | +- |
| 23 | +- // Configure chunk file names to use chunk name as directory |
| 24 | +- nitro.options.rollupConfig.output.chunkFileNames = (chunkInfo) => { |
| 25 | +- const chunkName = chunkInfo.name || 'chunks' |
| 26 | +- return `${chunkName}/[name].mjs` |
| 27 | +- } |
| 28 | +- }, |
| 29 | +- }, |
| 30 | + runtimeConfig: { |
| 31 | + graphqlYoga: { |
| 32 | + endpoint: '/api/graphql', |
| 33 | +diff --git a/src/index.ts b/src/index.ts |
| 34 | +index 01dcf25..27f1125 100644 |
| 35 | +--- a/src/index.ts |
| 36 | ++++ b/src/index.ts |
| 37 | +@@ -14,14 +14,6 @@ import { setupGraphQLWatcher } from './watcher' |
| 38 | + export default defineNitroModule({ |
| 39 | + name: 'nitro:graphql-yoga', |
| 40 | + async setup(nitro: Nitro) { |
| 41 | +- // Configure chunk directory naming |
| 42 | +- nitro.options.rollupConfig = nitro.options.rollupConfig || {} |
| 43 | +- nitro.options.rollupConfig.output = nitro.options.rollupConfig.output || {} |
| 44 | +- |
| 45 | +- // Configure chunk file names to use 'graphql' directory instead of '_' |
| 46 | +- nitro.options.rollupConfig.output.chunkFileNames = (chunkInfo) => { |
| 47 | +- return `graphql/[name].mjs` |
| 48 | +- } |
| 49 | + |
| 50 | + // Add virtual imports |
| 51 | + nitro.options.virtual ??= {} |
0 commit comments