Update out directories for Netlify Functions (#3381)
* Change out directories for Netlify Functions * Changeset * Update test
This commit is contained in:
parent
0259d7658b
commit
43d922277a
4 changed files with 12 additions and 4 deletions
5
.changeset/eight-feet-reflect.md
Normal file
5
.changeset/eight-feet-reflect.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/netlify': minor
|
||||
---
|
||||
|
||||
Updating out directories for Netlify Functions
|
|
@ -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';
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in a new issue