From d3678e6ce2b9ea84a2da454c199ea6588b8eef3a Mon Sep 17 00:00:00 2001 From: Alec Aivazis Date: Wed, 11 Oct 2023 22:41:41 -0700 Subject: [PATCH] pull ssr out of asset dir --- packages/houdini/src/vite/houdini.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/houdini/src/vite/houdini.ts b/packages/houdini/src/vite/houdini.ts index 53e7ff57da..49b3a2e75a 100644 --- a/packages/houdini/src/vite/houdini.ts +++ b/packages/houdini/src/vite/houdini.ts @@ -98,6 +98,10 @@ export default function Plugin(opts: PluginConfig = {}): VitePlugin { return } + // dry + const outDir = config.routerBuildDirectory + const sourceDir = viteConfig.build.outDir + // tell the user what we're doing console.log('🎩 Generating Deployment Assets...') @@ -113,15 +117,20 @@ export default function Plugin(opts: PluginConfig = {}): VitePlugin { // load the project manifest const manifest = await load_manifest({ config, includeArtifacts: true }) + // before we load the adapter we want to do some manual prep on the directories + // pull the ssr directory out of assets + await fs.recursiveCopy(path.join(sourceDir, 'ssr'), path.join(outDir, 'ssr')) + await fs.rmdir(path.join(sourceDir, 'ssr')) + // invoke the adapter await opts.adapter({ config, conventions: routerConventions, - sourceDir: viteConfig.build.outDir, + sourceDir, publicBase: viteConfig.base, - outDir: config.routerBuildDirectory, + outDir, manifest, - adapterPath: './assets/ssr/entries/adapter', + adapterPath: './ssr/entries/adapter', }) // if there is a public directory at the root of the project,