0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-10 23:01:26 -05:00
astro/.changeset/ninety-clouds-judge.md
Dani Fernández 1b5037bd77
Update netlify adapter to integrate includeFiles and excludeFiles options (#13194)
* feat: integrated includeFiles and excludeFiles on netlify adapter

* feat: added netlify include and exclude files tests

* feat: changelogs added

* fix: avoid problems with glob file url on windows

* feat: improved JS Docs to include examples and important information

* feat: removed non necessary root path as glob is already absolute

* Apply suggestions from code review

* Update packages/integrations/netlify/src/index.ts

Co-authored-by: Matt Kane <m@mk.gg>

* Update .changeset/ninety-clouds-judge.md

Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>

---------

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Co-authored-by: Matt Kane <m@mk.gg>
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
2025-02-12 14:08:38 +00:00

1.2 KiB

@astrojs/netlify
minor

Adds includedFiles and excludedFiles configuration options to customize SSR function bundle contents.

The includeFiles property allows you to explicitly specify additional files that should be bundled with your function. This is useful for files that aren't automatically detected as dependencies, such as:

  • Data files loaded using fs operations
  • Configuration files
  • Template files

Similarly, you can use the excludeFiles property to prevent specific files from being bundled that would otherwise be included. This is helpful for:

  • Reducing bundle size
  • Excluding large binaries
  • Preventing unwanted files from being deployed
import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify';

export default defineConfig({
  // ...
  output: 'server',
  adapter: netlify({
    includeFiles: ['./my-data.json'],
     excludeFiles: [
      './node_modules/package/**/*',
      './src/**/*.test.js'
    ],
  }),
});

See the Netlify adapter documentation for detailed usage instructions and examples.