-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
56 lines (53 loc) · 1.28 KB
/
vite.config.ts
File metadata and controls
56 lines (53 loc) · 1.28 KB
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
import { resolve } from 'path'
import { defineConfig } from 'vite'
import type { LibraryOptions } from 'vite'
import react from '@vitejs/plugin-react'
import tsconfigPaths from 'vite-tsconfig-paths'
import dts from 'vite-plugin-dts'
import pkg from './package.json'
const dependencies = Object.keys(pkg.dependencies || {})
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
tsconfigPaths(),
dts({
entryRoot: 'src',
insertTypesEntry: true,
include: [
'src/hooks',
'src/config',
'src/base',
'src/pro',
],
}),
],
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
'@material-ui/icons': '@material-ui/icons/esm',
},
},
build: {
minify: false,
rollupOptions: {
preserveEntrySignatures: 'allow-extension',
external: (source) => dependencies.some(dep => source.startsWith(dep)),
input: {
main: 'src/index.tsx',
base: 'src/base/index.tsx',
pro: 'src/pro/index.tsx',
hooks: 'src/hooks/index.tsx',
},
output: {
format: 'es',
entryFileNames: '[name]/index.js',
globals: {
react: 'React',
'react-dom': 'ReactDOM'
},
},
},
target: 'es2015',
},
})