Skip to content

Commit 3d45202

Browse files
authored
Add proj4 as external dependency in Vite config (#3)
* Add proj4 as external dependency in Vite config Updated the Vite configuration to treat 'proj4' as an external dependency alongside 'maplibre-gl', and added its global mapping for UMD builds. This prevents bundling 'proj4' into the library output. * Create chilly-jeans-knock.md
1 parent ff4ae43 commit 3d45202

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

.changeset/chilly-jeans-knock.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@naivemap/maplibre-gl-image-layer': patch
3+
---
4+
5+
Add proj4 as external dependency in Vite config

packages/maplibre-gl-image-layer/vite.config.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@ export default defineConfig({
1010
build: {
1111
lib: {
1212
entry: resolve(__dirname, 'src/index.ts'),
13-
name: 'ImageLayer', // 暴露的全局变量名
14-
fileName: 'index' // 输出的包文件名
13+
name: 'ImageLayer',
14+
fileName: 'index'
1515
},
1616
rollupOptions: {
17-
// 确保外部化处理那些你不想打包进库的依赖
18-
external: ['maplibre-gl'],
17+
external: ['maplibre-gl', 'proj4'],
1918
output: {
20-
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
2119
globals: {
22-
'maplibre-gl': 'maplibregl'
20+
'maplibre-gl': 'maplibregl',
21+
proj4: 'proj4'
2322
}
2423
}
2524
}

0 commit comments

Comments
 (0)