github withastro/astro @astrojs/internal-helpers@0.3.0

latest releases: @astrojs/svelte@6.0.1, astro@4.16.13, @astrojs/solid-js@4.4.3...
8 months ago

Minor Changes

  • #10189 1ea0a25b94125e4f6f2ac82b42f638e22d7bdffd Thanks @peng! - Adds the option to pass an object to build.assetsPrefix. This allows for the use of multiple CDN prefixes based on the target file type.

    When passing an object to build.assetsPrefix, you must also specify a fallback domain to be used for all other file types not specified.

    Specify a file extension as the key (e.g. 'js', 'png') and the URL serving your assets of that file type as the value:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      build: {
        assetsPrefix: {
          js: 'https://js.cdn.example.com',
          mjs: 'https://js.cdn.example.com', // if you have .mjs files, you must add a new entry like this
          png: 'https://images.cdn.example.com',
          fallback: 'https://generic.cdn.example.com',
        },
      },
    });

Don't miss a new astro release

NewReleases is sending notifications on new releases.