From e1294c422b3d3e98ccc745fe95d5672c9a17fe1f Mon Sep 17 00:00:00 2001 From: Sarah Etter Date: Mon, 16 May 2022 11:58:31 -0400 Subject: [PATCH] Netlify outdirectory (#3377) * Change dist directory, and functions out directory * Add changeset * update docs * Fix changeset --- .changeset/fair-kangaroos-talk.md | 5 +++++ packages/integrations/netlify/README.md | 2 +- .../integrations/netlify/src/integration-edge-functions.ts | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/fair-kangaroos-talk.md diff --git a/.changeset/fair-kangaroos-talk.md b/.changeset/fair-kangaroos-talk.md new file mode 100644 index 0000000000..ae5937fa47 --- /dev/null +++ b/.changeset/fair-kangaroos-talk.md @@ -0,0 +1,5 @@ +--- +'@astrojs/netlify': minor +--- + +Change out directories on dist and serverEntry diff --git a/packages/integrations/netlify/README.md b/packages/integrations/netlify/README.md index 29a858d33b..02e11a19e9 100644 --- a/packages/integrations/netlify/README.md +++ b/packages/integrations/netlify/README.md @@ -39,7 +39,7 @@ export default defineConfig({ ### dist -We build to a `netlify` directory at the base of your project. To change this, use the `dist` option: +For Netlify Functions, we build to a `netlify` directory at the base of your project. In the case of Netlify Edge Functions, we build to a `dist` directory at the base of your project. To change this, use the `dist` option: ```js import { defineConfig } from 'astro/config'; diff --git a/packages/integrations/netlify/src/integration-edge-functions.ts b/packages/integrations/netlify/src/integration-edge-functions.ts index 0f28aeab59..843caedc18 100644 --- a/packages/integrations/netlify/src/integration-edge-functions.ts +++ b/packages/integrations/netlify/src/integration-edge-functions.ts @@ -72,7 +72,7 @@ export function netlifyEdgeFunctions({ dist }: NetlifyEdgeFunctionsOptions = {}) if (dist) { config.outDir = dist; } else { - config.outDir = new URL('./netlify/', config.root); + config.outDir = new URL('./dist/', config.root); } }, 'astro:config:done': ({ config, setAdapter }) => { @@ -82,7 +82,7 @@ export function netlifyEdgeFunctions({ dist }: NetlifyEdgeFunctionsOptions = {}) 'astro:build:start': async ({ buildConfig }) => { entryFile = buildConfig.serverEntry.replace(/\.m?js/, ''); buildConfig.client = _config.outDir; - buildConfig.server = new URL('./edge-functions/', _config.outDir); + buildConfig.server = new URL('./.netlify/edge-functions/', _config.root); buildConfig.serverEntry = 'entry.js'; }, 'astro:build:setup': ({ vite, target }) => {