-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
37 lines (34 loc) · 1.01 KB
/
vite.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
import vitePluginVue from '@vitejs/plugin-vue';
import path from 'path';
import { defineConfig } from 'vite';
import vitePluginEslint from 'vite-plugin-eslint';
import viteSvgLoader from 'vite-svg-loader';
const isDev = process.env.NODE_ENV === 'development';
function generateRichClassName(name: string, filename: string) {
// @ts-ignore
const { groups: { fileName } } = /(?<fileName>\w+)(\.\w+)*(\.\w+)(\?.+)?$/.exec(filename);
return `${fileName}_${name}`;
}
export default defineConfig({
plugins: [
vitePluginVue(),
vitePluginEslint(),
viteSvgLoader({
svgoConfig: {
plugins: [{
name: 'preset-default',
params: { overrides: { removeViewBox: false } },
}],
},
}),
],
base: '/vue-crm-materio/',
css: { modules: { generateScopedName: isDev ? generateRichClassName : undefined } },
build: { outDir: './docs' },
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@public': path.resolve(__dirname, './public'),
},
},
});