-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.iife.ts
More file actions
77 lines (76 loc) · 2.12 KB
/
Copy pathvite.config.iife.ts
File metadata and controls
77 lines (76 loc) · 2.12 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import tailwindcss from '@tailwindcss/vite';
import { resolve } from 'path';
export default defineConfig({
plugins: [react(), tailwindcss()],
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
},
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json'],
},
build: {
emptyOutDir: false,
assetsInlineLimit: 0,
lib: {
entry: resolve(__dirname, 'src/index.ts'),
name: 'AimapUI',
formats: ['iife'],
fileName: () => 'index.iife.js',
},
rollupOptions: {
external: [
'react',
/^react\//,
'react-dom',
/^react-dom\//,
'ahooks',
'clsx',
'geotiff',
'supercluster',
'@antv/l7',
'@antv/l7-core',
/^@antv\/l7-core\//,
'@antv/l7-layers',
/^@antv\/l7-layers\//,
'@antv/l7-component',
/^@antv\/l7-component\//,
'@antv/l7-source',
/^@antv\/l7-source\//,
'@antv/l7-scene',
/^@antv\/l7-scene\//,
'@antv/l7-utils',
/^@antv\/l7-utils\//,
'@antv/l7-map',
/^@antv\/l7-map\//,
],
output: {
globals: {
react: 'React',
'react/jsx-runtime': 'React',
'react/jsx-dev-runtime': 'React',
'react-dom': 'ReactDOM',
'react-dom/client': 'ReactDOM',
ahooks: 'ahooks',
clsx: 'clsx',
geotiff: 'GeoTIFF',
supercluster: 'Supercluster',
'@antv/l7': 'L7',
'@antv/l7-core': 'L7Core',
'@antv/l7-layers': 'L7Layers',
'@antv/l7-component': 'L7Component',
'@antv/l7-source': 'L7Source',
'@antv/l7-scene': 'L7Scene',
'@antv/l7-utils': 'L7Utils',
'@antv/l7-map': 'L7Map',
},
assetFileNames: (assetInfo) => {
// CSS 产物已由 ESM 构建输出,IIFE 不需要重复输出
if (assetInfo.names?.includes('style.css')) return 'style.css';
return assetInfo.names?.[0] ?? 'assets/[name]-[hash][extname]';
},
},
},
},
});