-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.mjs
More file actions
55 lines (52 loc) · 1.69 KB
/
astro.config.mjs
File metadata and controls
55 lines (52 loc) · 1.69 KB
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
import { defineConfig } from "astro/config";
import tailwindcss from "@tailwindcss/vite";
import react from "@astrojs/react";
import vercel from "@astrojs/vercel";
import icon from "astro-icon";
// Derive API URL for Vercel preview deployments
if (
!process.env.PUBLIC_TIDES_API_URL &&
process.env.VERCEL_ENV === "preview" &&
process.env.VERCEL_BRANCH_URL
) {
process.env.PUBLIC_TIDES_API_URL = `https://api-${process.env.VERCEL_BRANCH_URL}`;
}
// https://astro.build/config
export default defineConfig({
site: "https://openwaters.io",
integrations: [react(), icon()],
vite: {
plugins: [tailwindcss()],
optimizeDeps: {
include: ["maplibre-gl"],
esbuildOptions: {
target: "es2022",
},
},
resolve: {
// Deduplicate React to ensure a single instance across the file: symlink boundary.
dedupe: ["react", "react-dom", "react/jsx-runtime"],
},
ssr: {
// Process these through Vite's bundler for SSR (instead of externalizing to Node)
// so that resolve.dedupe applies to React, and browser-only packages don't fail.
// Includes @neaps/react and all its dependencies (which live in the neaps workspace
// and have ESM extensionless imports that Node.js can't resolve natively).
noExternal: [
"@neaps/react",
// @neaps/react dependencies (and their transitive deps that use ESM
// extensionless imports, which Node.js can't resolve natively)
/^@visx\//,
"@tanstack/react-query",
"astronomy-engine",
"d3-array",
"date-fns",
// map dependencies
"maplibre-gl",
"react-map-gl",
],
},
},
adapter: vercel({}),
output: "static",
});