mirror of
https://github.com/withastro/astro.git
synced 2024-12-30 22:03:56 -05:00
Netlify outdirectory (#3377)
* Change dist directory, and functions out directory * Add changeset * update docs * Fix changeset
This commit is contained in:
parent
e8007c3b8f
commit
e1294c422b
3 changed files with 8 additions and 3 deletions
5
.changeset/fair-kangaroos-talk.md
Normal file
5
.changeset/fair-kangaroos-talk.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@astrojs/netlify': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Change out directories on dist and serverEntry
|
|
@ -39,7 +39,7 @@ export default defineConfig({
|
||||||
|
|
||||||
### dist
|
### 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
|
```js
|
||||||
import { defineConfig } from 'astro/config';
|
import { defineConfig } from 'astro/config';
|
||||||
|
|
|
@ -72,7 +72,7 @@ export function netlifyEdgeFunctions({ dist }: NetlifyEdgeFunctionsOptions = {})
|
||||||
if (dist) {
|
if (dist) {
|
||||||
config.outDir = dist;
|
config.outDir = dist;
|
||||||
} else {
|
} else {
|
||||||
config.outDir = new URL('./netlify/', config.root);
|
config.outDir = new URL('./dist/', config.root);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'astro:config:done': ({ config, setAdapter }) => {
|
'astro:config:done': ({ config, setAdapter }) => {
|
||||||
|
@ -82,7 +82,7 @@ export function netlifyEdgeFunctions({ dist }: NetlifyEdgeFunctionsOptions = {})
|
||||||
'astro:build:start': async ({ buildConfig }) => {
|
'astro:build:start': async ({ buildConfig }) => {
|
||||||
entryFile = buildConfig.serverEntry.replace(/\.m?js/, '');
|
entryFile = buildConfig.serverEntry.replace(/\.m?js/, '');
|
||||||
buildConfig.client = _config.outDir;
|
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';
|
buildConfig.serverEntry = 'entry.js';
|
||||||
},
|
},
|
||||||
'astro:build:setup': ({ vite, target }) => {
|
'astro:build:setup': ({ vite, target }) => {
|
||||||
|
|
Loading…
Reference in a new issue