Skip to content

Commit 43d9222

Browse files
authored
Update out directories for Netlify Functions (#3381)
* Change out directories for Netlify Functions * Changeset * Update test
1 parent 0259d76 commit 43d9222

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

.changeset/eight-feet-reflect.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@astrojs/netlify': minor
3+
---
4+
5+
Updating out directories for Netlify Functions

packages/integrations/netlify/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default defineConfig({
3939

4040
### dist
4141

42-
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:
42+
We build to a `dist` directory at the base of your project. To change this, use the `dist` option:
4343

4444
```js
4545
import { defineConfig } from 'astro/config';

packages/integrations/netlify/src/integration-functions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function netlifyFunctions({ dist }: NetlifyFunctionsOptions = {}): AstroIntegrat
2424
if (dist) {
2525
config.outDir = dist;
2626
} else {
27-
config.outDir = new URL('./netlify/', config.root);
27+
config.outDir = new URL('./dist/', config.root);
2828
}
2929
},
3030
'astro:config:done': ({ config, setAdapter }) => {
@@ -34,7 +34,7 @@ function netlifyFunctions({ dist }: NetlifyFunctionsOptions = {}): AstroIntegrat
3434
'astro:build:start': async ({ buildConfig }) => {
3535
entryFile = buildConfig.serverEntry.replace(/\.m?js/, '');
3636
buildConfig.client = _config.outDir;
37-
buildConfig.server = new URL('./functions/', _config.outDir);
37+
buildConfig.server = new URL('./.netlify/functions-internal/', _config.root);
3838
},
3939
'astro:build:done': async ({ routes, dir }) => {
4040
await createRedirects(routes, dir, entryFile, false);

packages/integrations/netlify/test/functions/cookies.test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ describe('Cookies', () => {
2424
});
2525

2626
it('Can set multiple', async () => {
27-
const entryURL = new URL('./fixtures/cookies/dist/functions/entry.mjs', import.meta.url);
27+
const entryURL = new URL(
28+
'./fixtures/cookies/.netlify/functions-internal/entry.mjs',
29+
import.meta.url
30+
);
2831
const { handler } = await import(entryURL);
2932
const resp = await handler({
3033
httpMethod: 'POST',

0 commit comments

Comments
 (0)