Skip to content

Commit

Permalink
dont ssr load local schema ever
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecAivazis committed Sep 28, 2023
1 parent ff58f3e commit 523abe9
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion packages/houdini-plugin-svelte-global-stores/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@
},
"main": "./build/plugin-cjs/index.js",
"types": "./build/plugin/index.d.ts"
}
}
2 changes: 1 addition & 1 deletion packages/houdini-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@
},
"main": "./build/plugin-cjs/index.js",
"types": "./build/plugin/index.d.ts"
}
}
9 changes: 2 additions & 7 deletions packages/houdini-react/src/plugin/vite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
RouterManifest,
find_match,
localApiEndpoint,
buildLocalSchema,
loadLocalSchema,
} from 'houdini'
import type { BuildOptions } from 'vite'

Expand Down Expand Up @@ -227,12 +227,7 @@ if (window.__houdini__nav_caches__ && window.__houdini__nav_caches__.artifact_ca
// import the schema
let schema: GraphQLSchema | null = null
if (project_manifest.local_schema) {
await buildLocalSchema(server.houdiniConfig)
schema = (
await server.ssrLoadModule(
path.join(server.houdiniConfig.rootDir, 'temp', 'assets', 'schema.js')
)
).default
schema = await loadLocalSchema(server.houdiniConfig)
}
// import the schema
const serverAdapter: (
Expand Down
2 changes: 1 addition & 1 deletion packages/houdini-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@
},
"main": "./build/plugin-cjs/index.js",
"types": "./build/plugin/index.d.ts"
}
}
2 changes: 1 addition & 1 deletion packages/houdini/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@
"bin": "./build/cmd-esm/index.js",
"main": "./build/lib-cjs/index.js",
"types": "./build/lib/index.d.ts"
}
}
1 change: 1 addition & 0 deletions packages/houdini/src/lib/router/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export async function buildLocalSchema(config: Config): Promise<void> {

process.env.HOUDINI_SCHEMA_BUILD = 'true'

console.log(path.join(config.localApiDir, '+schema'))
// build the schema somewhere we can import from
await build({
logLevel: 'silent',
Expand Down
8 changes: 1 addition & 7 deletions packages/houdini/src/vite/houdini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,7 @@ export default function Plugin(opts: PluginConfig = {}): VitePlugin {

// if there is a local schema we need to use that when generating
if (config.localSchema) {
await buildLocalSchema(config)
const { default: schema } = (await server.ssrLoadModule(
path.join(config.rootDir, 'temp', 'assets', 'schema.js')
),
{}) as { default: graphql.GraphQLSchema }

config.schema = schema
config.schema = await loadLocalSchema(config)
}

process.env.HOUDINI_PORT = String(server.config.server.port ?? 5173)
Expand Down

0 comments on commit 523abe9

Please sign in to comment.