-
Notifications
You must be signed in to change notification settings - Fork 38
/
vite.config.ts
39 lines (38 loc) · 964 Bytes
/
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
38
39
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import typescript from '@rollup/plugin-typescript';
import { resolve } from 'path';
const resolvePath = (str: string) => resolve(__dirname, str);
export default defineConfig({
plugins: [react()],
css: {
preprocessorOptions: {
scss: {
additionalData: '@import "./src/styles/app.scss";', // 添加公共样式
},
},
},
build: {
lib: {
entry: resolvePath('packages/index.ts'),
name: 'licht-ui',
fileName: (format) => `licht-ui.${format}.js`,
},
rollupOptions: {
external: ['react', 'react-dom'],
output: {
globals: {
react: 'react',
'react-dom': 'react-dom',
},
},
plugins: [
typescript({
tslib: resolve('typescript'),
// exclude:['packages/**/*index.ts'],
outDir: resolvePath('dist'),
}),
],
},
},
});