Produce CommonJS and UMD bundles (#932)

This commit is contained in:
Michael Diego 2020-09-01 05:05:06 +02:00 committed by GitHub
parent 24b9c93228
commit 9e06d200b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 2 deletions

View File

@ -15,8 +15,8 @@
"node": ">=10"
},
"scripts": {
"build": "microbundle-crl --no-compress --format modern,cjs",
"start": "microbundle-crl watch --no-compress --format modern,cjs",
"build": "microbundle-crl -f cjs,umd src/index.cjs.js && microbundle-crl -f es,modern src/index.js",
"start": "microbundle-crl watch -f cjs,umd",
"prepare": "run-s build",
"test": "run-s test:unit test:lint test:build",
"test:build": "run-s build",

23
src/index.cjs.js Normal file
View File

@ -0,0 +1,23 @@
import GoogleMap from './google_map';
import {
convertNeSwToNwSe,
convertNwSeToNeSw,
fitBounds,
meters2ScreenPixels,
tile2LatLng,
latLng2Tile,
getTilesIds,
} from './lib';
Object.assign(GoogleMap, {
convertNeSwToNwSe,
convertNwSeToNeSw,
fitBounds,
meters2ScreenPixels,
tile2LatLng,
latLng2Tile,
getTilesIds,
});
export default GoogleMap;

View File

@ -1,3 +1,13 @@
import GoogleMap from './google_map';
export {
convertNeSwToNwSe,
convertNwSeToNeSw,
fitBounds,
meters2ScreenPixels,
tile2LatLng,
latLng2Tile,
getTilesIds,
} from './lib';
export default GoogleMap;