-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuxt.config.ts
126 lines (121 loc) · 3.06 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
import * as fs from "fs";
import chalk from "chalk";
import vuetify from "vite-plugin-vuetify";
import license from "rollup-plugin-license";
/**
* Returns all locales with their corresponding file names from `./locales`.
*/
export function getLocales(): { code: string; file: string }[] {
const files = fs.readdirSync("./locales");
return files.map((file) => {
return {
code: file.split(".")[0],
file,
};
});
}
export default defineNuxtConfig({
app: {
pageTransition: { name: "page", mode: "out-in" },
head: {
link: [
{
as: "font",
rel: "preload",
href: "/assets/fonts/roboto/files/roboto-latin-400-normal.woff2",
crossorigin: "anonymous",
},
{
rel: "stylesheet",
href: "/assets/fonts/roboto/index.css",
},
// Favicon generated with https://realfavicongenerator.net/
{
rel: "icon",
type: "image/png",
sizes: "32x32",
href: "/assets/favicon/favicon-32x32.png",
},
{
rel: "icon",
type: "image/png",
sizes: "16x16",
href: "/assets/favicon/favicon-16x16.png",
},
{
rel: "apple-touch-icon",
sizes: "180x180",
href: "/assets/favicon/apple-touch-icon.png",
},
{
rel: "manifest",
href: "/assets/favicon/site.webmanifest",
crossorigin: "use-credentials",
},
{
rel: "mask-icon",
href: "/assets/favicon/safari-pinned-tab.svg",
color: "#5bbad5",
},
],
},
},
css: ["vuetify/styles"],
modules: [
"@crystal-creations/crystal-components/nuxt",
"@nuxt/image",
[
"@nuxtjs/i18n",
{
locales: getLocales(),
langDir: "locales",
},
],
"@nuxtjs/robots",
],
hooks: {
"nitro:build:before": () => {
const fontsDir = "public/assets/fonts/";
fs.cpSync("node_modules/@fontsource/", fontsDir, {
recursive: true,
});
console.log(chalk.green("√"), "Copied fonts to " + fontsDir);
},
},
vite: {
define: {
"process.env.DEBUG": "false",
},
ssr: {
noExternal: ["vuetify"],
},
plugins: [
vuetify(),
license({
thirdParty: {
includePrivate: false,
allow: {
test: (dependency) => {
// Return false for unlicensed dependencies.
if (!dependency.license) return false;
// Allow MIT and Apache-2.0 licenses.
return ["MIT", "Apache-2.0"].includes(dependency.license);
},
failOnUnlicensed: true,
failOnViolation: true,
},
output: {
// Output file into public directory which is included in the build output.
file: "public/dependencies.json",
template(dependencies) {
return JSON.stringify(dependencies);
},
},
},
}),
],
},
nitro: {
compressPublicAssets: true,
},
});