File tree Expand file tree Collapse file tree 4 files changed +28
-5
lines changed Expand file tree Collapse file tree 4 files changed +28
-5
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "internal" : true ,
3
+ "main" : " dist/maplibre/cjs/main.js" ,
4
+ "module" : " dist/maplibre/es/main.js" ,
5
+ "types" : " src/main-maplibre.ts" ,
6
+ "sideEffects" : false
7
+ }
Original file line number Diff line number Diff line change 4
4
"description" : " Use react-three-fiber inside MapLibre and Mapbox" ,
5
5
"main" : " dist/cjs/main.js" ,
6
6
"module" : " dist/es/main.js" ,
7
- "types" : " src/main.ts" ,
7
+ "types" : " src/main-mapbox .ts" ,
8
8
"sideEffects" : false ,
9
9
"repository" : " https://github.com/RodrigoHamuy/react-three-map" ,
10
10
"homepage" : " https://github.com/RodrigoHamuy/react-three-map" ,
16
16
"scripts" : {
17
17
"dev" : " vite" ,
18
18
"prebuild" : " tsc" ,
19
- "build" : " cross-env LIB_MODE=1 vite build" ,
20
- "postbuild" : " cross-env LIB_MODE=2 vite build" ,
19
+ "build" : " yarn build:maplibre && yarn build:mapbox" ,
20
+ "build:maplibre" : " cross-env LIB_MODE=1 MAP_MODE=0 vite build" ,
21
+ "postbuild:maplibre" : " cross-env LIB_MODE=2 MAP_MODE=0 vite build" ,
22
+ "build:mapbox" : " cross-env LIB_MODE=1 MAP_MODE=1 vite build" ,
23
+ "postbuild:mapbox" : " cross-env LIB_MODE=2 MAP_MODE=1 vite build" ,
21
24
"lint" : " eslint src --ext ts,tsx --fix" ,
22
25
"preview" : " vite preview" ,
23
26
"ts" : " tsc -w" ,
Original file line number Diff line number Diff line change
1
+ export * from './canvas/canvas-mapbox' ;
Original file line number Diff line number Diff line change @@ -3,8 +3,20 @@ import react from '@vitejs/plugin-react'
3
3
4
4
/** 0: no lib mode, 1: ES, 2: cjs */
5
5
const libMode = parseInt ( process . env . LIB_MODE ! ) || 0 ;
6
+
7
+ /** 0: MapLibre, 1: MapBox */
8
+ const mapProvider = parseInt ( process . env . MAP_MODE ! ) || 0 ;
9
+
6
10
const isES = libMode === 1 ;
7
11
12
+ const isMaplibre = mapProvider === 0 ;
13
+
14
+ const entry = `src/main-${ isMaplibre ? 'maplibre' : 'mapbox' } .ts` ;
15
+
16
+ let outDir = isMaplibre ? 'dist/maplibre' : 'dist' ;
17
+
18
+ outDir = `${ outDir } /${ isES ? 'es' : 'cjs' } ` ;
19
+
8
20
// https://vitejs.dev/config/
9
21
export default defineConfig ( {
10
22
plugins : [ react ( ) ] ,
@@ -15,12 +27,12 @@ export default defineConfig({
15
27
: {
16
28
build : {
17
29
lib : {
18
- entry : 'src/main-maplibre.ts' ,
30
+ entry,
19
31
name : 'react-three-map' ,
20
32
formats : isES ? [ 'es' ] : [ 'cjs' ] ,
21
33
fileName : 'main.js' ,
22
34
} ,
23
- outDir : isES ? 'dist/es' : 'dist/cjs' ,
35
+ outDir,
24
36
rollupOptions : {
25
37
output : ! isES ? undefined : { sourcemap : true , preserveModules : true } ,
26
38
external : [
You can’t perform that action at this time.
0 commit comments