0
Fork 0
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:
Sarah Etter 2022-05-16 11:58:31 -04:00 committed by GitHub
parent e8007c3b8f
commit e1294c422b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/netlify': minor
---
Change out directories on dist and serverEntry

View file

@ -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';

View file

@ -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 }) => {