forked from WordPress/openverse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuxt.config.ts
139 lines (133 loc) · 3.81 KB
/
nuxt.config.ts
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import { defineNuxtConfig } from "nuxt/config"
import { disallowedBots } from "./shared/constants/disallowed-bots"
import locales from "./i18n/data/valid-locales.json"
import type { LocaleObject } from "@nuxtjs/i18n"
export default defineNuxtConfig({
srcDir: "src/",
serverDir: "server/",
devServer: {
port: 8443,
host: "0.0.0.0",
},
imports: {
autoImport: false,
},
compatibilityDate: "2024-07-23",
css: ["~/assets/fonts.css", "~/styles/accent.css"],
/**
* Define available runtime configuration values and their defaults.
*
* See linked documentation for details, including how to override defaults
* with runtime values using environment variables.
*
* @see {@link https://nuxt.com/docs/api/nuxt-config#runtimeconfig-1}
*/
runtimeConfig: {
apiClientId: "",
apiClientSecret: "",
public: {
deploymentEnv: "local",
apiUrl: "https://api.openverse.org/",
savedSearchCount: 4,
site: {
trailingSlash: false,
},
sentry: {
dsn: "",
environment: "local",
// Release is a build time variable, and as such, is defined in app.config.ts
},
plausible: {
ignoredHostnames: ["localhost", "staging.openverse.org"],
logIgnoredEvents: true,
apiHost: "http://localhost:50290",
domain: "localhost",
},
},
},
/**
* Disable debug mode to prevent excessive timing logs.
*/
debug: false,
experimental: {
/**
* Improve router performance, see https://nuxt.com/blog/v3-10#%EF%B8%8F-build-time-route-metadata
*/
scanPageMeta: true,
},
modules: [
"@pinia/nuxt",
"@nuxtjs/i18n",
"@nuxtjs/tailwindcss",
"@nuxtjs/plausible",
"@nuxtjs/storybook",
"@nuxt/test-utils/module",
"@nuxtjs/sitemap",
"@nuxtjs/robots",
"@sentry/nuxt/module",
],
routeRules: {
"/photos/**": { redirect: { to: "/image/**", statusCode: 301 } },
"/meta-search": { redirect: { to: "/about", statusCode: 301 } },
"/external-sources": { redirect: { to: "/about", statusCode: 301 } },
},
/**
* Robots.txt rules are configured here via the \@nuxtjs/robots package.
* @see {@link https://nuxtseo.com/robots/guides/nuxt-config}
*/
robots: {
disallow: [
// robots rules are prefixed-based, so there's no need to configure specific media type searches
"/search",
// Other routes have more complex requirements; we configure those with `useRobotsRule` as needed
],
groups: [
...disallowedBots.map((bot) => ({
userAgent: [bot],
disallow: ["/"], // block disallowed bots from all routes
})),
],
},
tailwindcss: {
cssPath: "~/styles/tailwind.css",
},
i18n: {
locales: [
{
/* Nuxt i18n fields */
code: "en", // unique identifier for the locale in Vue i18n
dir: "ltr",
file: "en.json",
language: "en", // used for SEO purposes (html lang attribute)
isCatchallLocale: true, // the catchall locale for `en` locales
/* Custom fields */
name: "English",
nativeName: "English",
},
...locales,
].filter((l) => Boolean(l.language)) as LocaleObject[],
lazy: true,
langDir: "locales",
defaultLocale: "en",
/**
* `detectBrowserLanguage` must be false to prevent nuxt/i18n from automatically
* setting the locale based on headers or the client-side `navigator` object.
*
* More info about the Nuxt i18n:
*
* - [Browser language detection info](https://i18n.nuxtjs.org/docs/guide/browser-language-detection)
* */
detectBrowserLanguage: false,
trailingSlash: false,
vueI18n: "./vue-i18n",
},
sentry: {
sourceMapsUploadOptions: {
org: "openverse",
project: "openverse-frontend",
},
},
sourcemap: {
client: "hidden",
},
})