forked from HuolalaTech/page-spy-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.mjs
40 lines (38 loc) · 925 Bytes
/
vite.config.mjs
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
import { defineConfig } from 'vite';
import path from 'path';
import react from '@vitejs/plugin-react';
import svgr from 'vite-plugin-svgr';
import mdx from '@mdx-js/rollup';
export default ({ mode, command }) => {
const buildDoc = mode === 'doc';
const isProd = command === 'build';
return defineConfig({
base: './',
build: {
target: ['chrome100'],
sourcemap: isProd ? 'hidden' : true,
outDir: buildDoc ? 'docs-dist' : 'dist',
},
resolve: {
alias: [{ find: '@', replacement: path.join(__dirname, './src') }],
},
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
modifyVars: {
hack: `true; @import "${process.cwd()}/src/assets/style/variable.less";`,
},
},
},
},
plugins: [
{
enforce: 'pre',
...mdx(),
},
react(),
svgr(),
],
});
};