Skip to content

Commit

Permalink
Renamed out to tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanM04 committed Apr 6, 2022
1 parent 44fd08e commit 9af6eb9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/integrations/vercel/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ export default function vercel(): AstroIntegration {
'astro:build:start': async ({ buildConfig }) => {
buildConfig.serverEntry = `${ENTRYFILE}.mjs`;
buildConfig.client = new URL('./static/', _config.outDir);
buildConfig.server = new URL('./server/out/', _config.outDir);
buildConfig.server = new URL('./server/tmp/', _config.outDir);
},
'astro:build:done': async ({ dir, routes }) => {
/*
Why do we have two folder? Why don't we just generate all inside server/pages?
Why do we need two folders? Why don't we just generate all inside `server/pages/`?
When the app builds, it throws some metadata inside a `chunks/` folder.
./server/
Expand All @@ -50,22 +50,22 @@ export default function vercel(): AstroIntegration {
need to bundle as much as possible in one file. Hence, the following code
*/

const serverOutDir = new URL('./server/out/', dir);
const tmpDir = new URL('./server/tmp/', dir);
const bundleDir = new URL('./server/pages/', dir);

await fs.mkdir(bundleDir, { recursive: true });

// Convert server entry to CommonJS
await esbuild.build({
entryPoints: [fileURLToPath(new URL(`./${ENTRYFILE}.mjs`, serverOutDir))],
entryPoints: [fileURLToPath(new URL(`./${ENTRYFILE}.mjs`, tmpDir))],
outfile: fileURLToPath(new URL(`./${ENTRYFILE}.js`, bundleDir)),
bundle: true,
format: 'cjs',
platform: 'node',
target: 'node14',
});

await fs.rm(serverOutDir, { recursive: true });
await fs.rm(tmpDir, { recursive: true });

// Routes Manifest
// https://vercel.com/docs/file-system-api#configuration/routes
Expand Down

0 comments on commit 9af6eb9

Please sign in to comment.