-
Notifications
You must be signed in to change notification settings - Fork 1
/
nuxt.config.ts
162 lines (136 loc) · 3.33 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import "dotenv/config";
import Icons from "unplugin-icons/vite";
import ShortUniqueId from "short-unique-id";
import cssesc from "cssesc";
import VitePluginChecker from "vite-plugin-checker";
import SvgLoader from "vite-svg-loader";
import {
defineNuxtConfig,
} from "nuxt/config";
const ASSETS_PATH = "_assets";
const uid = new ShortUniqueId();
const identNameMap = new Map<string, string>();
const isProd = "production" === process.env.NODE_ENV;
const cssClassNameBlacklist = new Set([
"pi",
"fc",
]);
const CssNameValid = /^[_a-zA-Z]+[_a-zA-Z\d-]*$/g;
export default defineNuxtConfig({
typescript: {
strict: true,
shim: false,
},
// buildModules: [
// "@nuxt/typescript-build",
// ],
modules: [
"@vueuse/nuxt",
"@pinia/nuxt",
"nuxt-icons",
"@nuxtjs/plausible",
"nuxt-primevue",
],
build: {
transpile: [
"rambda",
"rambdax",
"graphql",
"tslib",
],
},
css: [
"@/assets/styles/theme/theme.scss",
],
app: {
buildAssetsDir: `/${ ASSETS_PATH }/`,
rootId: "__jobfair",
},
vite: {
css: {
modules: {
generateScopedName(name: string, absoluteFilePath: string) {
const relativeFilePath =
absoluteFilePath
.substring(__dirname.length + 1)
.split("?")
.shift() ?? "SOMETHING_WENT_WRONG_PARSE"
;
const idScope = `${ absoluteFilePath }/${ name }`;
if (!identNameMap.has(idScope)) {
let id;
do {
id = `jf_${ uid.sequentialUUID() }`;
} while (cssClassNameBlacklist.has(id) || !CssNameValid.test(id));
identNameMap.set(
idScope,
id,
);
}
const className = identNameMap.get(idScope) ?? "SOMETHING_WENT_WRONG_CLASS";
return cssesc(
isProd
? className
: `${ className }$${ relativeFilePath }::${ name }`
,
{
isIdentifier: true,
},
);
},
},
},
plugins: [
Icons({
compiler: "vue3",
defaultStyle: "",
defaultClass: "",
}),
SvgLoader(),
VitePluginChecker({
typescript: true,
stylelint: {
lintCommand: 'stylelint "**/*.{scss,css,vue}" --ignore-path .gitignore',
},
eslint: {
lintCommand: 'eslint --ext ".ts,.js,.vue" --ignore-path .gitignore --ignore-pattern "/backend/**/*"',
},
enableBuild: false,
}),
],
build: {
rollupOptions: {
output: {
assetFileNames: `${ ASSETS_PATH }/[name]-[hash][extname]`,
chunkFileNames: `${ ASSETS_PATH }/[name]-[hash].js`,
entryFileNames: `${ ASSETS_PATH }/[name]-[hash].js`,
},
},
},
},
runtimeConfig: {
public: {
API_BASE: process.env.NUXT_PUBLIC_API_BASE || "/api",
BASE_URL: process.env.NUXT_PUBLIC_BASE_URL || "",
SENTRY_DSN: process.env.SENTRY_DSN,
NODE_ENV: process.env.NODE_ENV,
},
},
telemetry: false,
plausible: {
autoOutboundTracking: true,
},
primevue: {
options: {
ripple: true,
inputStyle: "outlined",
},
components: {
prefix: "P",
include: [ "Button" ],
},
},
devtools: {
enabled: !isProd,
},
});