-
Notifications
You must be signed in to change notification settings - Fork 5
/
vite.config.js
68 lines (63 loc) · 1.51 KB
/
vite.config.js
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
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import RollupNodePolyFill from 'rollup-plugin-polyfill-node';
import NodeGlobalsPolyfillPlugin from '@esbuild-plugins/node-globals-polyfill';
// https://vitejs.dev/config/
// https://vitejs.dev/guide/build.html#public-base-path
export default defineConfig({
resolve: {
alias: {
'@': require('path').resolve(__dirname, './src')
}
},
plugins: [
vue({
preprocessStyles: true
})
],
css: {
preprocessorOptions: {
scss: {
additionalData(source, fp) {
if (fp.endsWith('colors.module.scss')) {
return source;
}
return `@use "@/styles/colors.module.scss" as *;\n\n${source}`;
}
}
}
},
base: '/',
build: {
outDir: 'dist',
rollupOptions: {
plugins: [
RollupNodePolyFill()
]
}
},
optimizeDeps: {
esbuildOptions: {
// Node.js global to browser globalThis
define: {
global: 'globalThis'
},
// Enable esbuild polyfill plugins
plugins: [
NodeGlobalsPolyfillPlugin({ buffer: true })
]
}
},
define: {
VERSION_INFO: JSON.stringify({
releaseDate: new Date().toISOString(),
buildNumber: process.env.CI_PIPELINE_ID,
buildRef: process.env.CI_COMMIT_REF_NAME,
buildCommit: process.env.CI_COMMIT_SHORT_SHA
}),
DEPLOYMENT_INFO: JSON.stringify({
FDQN: process.env.HOSTED_NAME,
LOG_TARGET: process.env.LOG_TARGET
})
}
});