-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathvite.config.ts
More file actions
61 lines (60 loc) · 1.49 KB
/
vite.config.ts
File metadata and controls
61 lines (60 loc) · 1.49 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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
import dts from 'vite-plugin-dts';
export default defineConfig({
plugins: [
react(),
dts({
include: ['src'],
outDir: 'dist/types',
rollupTypes: false,
}),
],
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
},
},
build: {
lib: {
entry: {
index: resolve(__dirname, 'src/index.ts'),
react: resolve(__dirname, 'src/react.ts'),
},
name: 'MapLibreUsgsLidar',
formats: ['es', 'cjs'],
fileName: (format, entryName) => {
const ext = format === 'es' ? 'mjs' : 'cjs';
return `${entryName}.${ext}`;
},
},
rollupOptions: {
external: [
'react',
'react-dom',
'maplibre-gl',
'@geoman-io/maplibre-geoman-free',
'maplibre-gl-lidar',
'maplibre-gl-geo-editor',
],
output: {
globals: {
react: 'React',
'react-dom': 'ReactDOM',
'maplibre-gl': 'maplibregl',
'@geoman-io/maplibre-geoman-free': 'Geoman',
'maplibre-gl-lidar': 'MapLibreLidar',
'maplibre-gl-geo-editor': 'MapLibreGeoEditor',
},
assetFileNames: (assetInfo) => {
if (assetInfo.name === 'style.css') return 'maplibre-gl-usgs-lidar.css';
return assetInfo.name || '';
},
},
},
cssCodeSplit: false,
sourcemap: true,
minify: false,
},
});