diff --git a/.changeset/eight-feet-reflect.md b/.changeset/eight-feet-reflect.md new file mode 100644 index 000000000..1b26622c5 --- /dev/null +++ b/.changeset/eight-feet-reflect.md @@ -0,0 +1,5 @@ +--- +'@astrojs/netlify': minor +--- + +Updating out directories for Netlify Functions diff --git a/packages/integrations/netlify/README.md b/packages/integrations/netlify/README.md index 02e11a19e..b0daeadef 100644 --- a/packages/integrations/netlify/README.md +++ b/packages/integrations/netlify/README.md @@ -39,7 +39,7 @@ export default defineConfig({ ### dist -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: +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-functions.ts b/packages/integrations/netlify/src/integration-functions.ts index b353220ce..fd8ec0b9a 100644 --- a/packages/integrations/netlify/src/integration-functions.ts +++ b/packages/integrations/netlify/src/integration-functions.ts @@ -24,7 +24,7 @@ function netlifyFunctions({ dist }: NetlifyFunctionsOptions = {}): AstroIntegrat 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 }) => { @@ -34,7 +34,7 @@ function netlifyFunctions({ dist }: NetlifyFunctionsOptions = {}): AstroIntegrat 'astro:build:start': async ({ buildConfig }) => { entryFile = buildConfig.serverEntry.replace(/\.m?js/, ''); buildConfig.client = _config.outDir; - buildConfig.server = new URL('./functions/', _config.outDir); + buildConfig.server = new URL('./.netlify/functions-internal/', _config.root); }, 'astro:build:done': async ({ routes, dir }) => { await createRedirects(routes, dir, entryFile, false); diff --git a/packages/integrations/netlify/test/functions/cookies.test.js b/packages/integrations/netlify/test/functions/cookies.test.js index 43c55916b..e9121b429 100644 --- a/packages/integrations/netlify/test/functions/cookies.test.js +++ b/packages/integrations/netlify/test/functions/cookies.test.js @@ -24,7 +24,10 @@ describe('Cookies', () => { }); it('Can set multiple', async () => { - const entryURL = new URL('./fixtures/cookies/dist/functions/entry.mjs', import.meta.url); + const entryURL = new URL( + './fixtures/cookies/.netlify/functions-internal/entry.mjs', + import.meta.url + ); const { handler } = await import(entryURL); const resp = await handler({ httpMethod: 'POST',