-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.config.mjs
78 lines (74 loc) · 1.88 KB
/
astro.config.mjs
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import path from "path";
import { fileURLToPath } from "url";
import { defineConfig } from "astro/config";
import { i18n, filterSitemapByDefaultLocale } from "astro-i18n-aut/integration";
import sitemap from "@astrojs/sitemap";
import react from "@astrojs/react";
import svgr from "vite-plugin-svgr";
// In ESM, __dirname is no longer available
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const defaultLocale = "en";
export const locales = {
en: "en-US", // the `defaultLocale` value must present in `locales` keys
es: "es-US",
};
// https://astro.build/config
export default defineConfig({
site: "https://example.com/",
base: "/build_with_base_path/",
trailingSlash: "always",
build: {
format: "directory",
},
output: "static",
// TODO: https://docs.astro.build/en/guides/internationalization/
// i18n: {
// defaultLocale: "en",
// locales: ["en", "es"],
// routing: {
// prefixDefaultLocale: false // Do not add /en/ to routes
// },
// fallback: {
// es: "en"
// }
// },
integrations: [
react(),
i18n({
locales,
defaultLocale,
}),
sitemap({
i18n: {
locales,
defaultLocale,
},
filter: filterSitemapByDefaultLocale({ defaultLocale }),
}),
],
// Pass additional configuration options to Vite: vitejs.dev
vite: {
plugins: [
svgr({
svgrOptions: {
// https://react-svgr.com/docs/options/#ref
ref: true,
},
}),
],
ssr: {
// Importing CSS files from @uswds package with file extension omitted e.g. @uswds/styles
noExternal: ["@uswds"],
},
css: {
preprocessorOptions: {
scss: {
includePaths: [
path.join(__dirname, "node_modules/@uswds/uswds/packages"),
path.join(__dirname, "src/styles"),
],
},
},
},
},
});