summaryrefslogtreecommitdiff
path: root/.changeset/fluffy-readers-add.md
blob: 22adc9bc621faa6f0190acd8b80da2661949eb72 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
---
"@astrojs/internal-helpers": minor
"astro": minor
---

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:

```js
// 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"
        }
    }
})
```