Skip to content

Commit 2e0553f

Browse files
committed
demos: add esbuild bundler
1 parent b600cad commit 2e0553f

File tree

6 files changed

+51
-3
lines changed

6 files changed

+51
-3
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
bundle.js
2-
demo-rollup/package-lock.json
3-
demo-webpack/package-lock.json
2+
demo-*/package-lock.json
43
dist/
54
node_modules/

demo-esbuild/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# leaflet-control-geocoder-demo-esbuild
2+
3+
This demo demonstrates the usage of leaflet-control-geocoder using the [esbuild](https://github.com/evanw/esbuild) bundler.
4+
5+
1. `cd demo-esbuild/`
6+
2. `npm install`
7+
3. `npm run build`
8+
4. `xdg-open index.html` or open `index.html` in your browser

demo-esbuild/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Leaflet Control Geocoder</title>
5+
<meta charset="utf-8" />
6+
<link rel="stylesheet" href="./dist/main.css" />
7+
</head>
8+
<body>
9+
<div id="map" style="width: 600px; height: 400px;"></div>
10+
<script src="./dist/main.js"></script>
11+
</body>
12+
</html>

demo-esbuild/main.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import L from 'leaflet';
2+
import 'leaflet-control-geocoder';
3+
4+
import 'leaflet/dist/leaflet.css';
5+
import 'leaflet-control-geocoder/dist/Control.Geocoder.css';
6+
7+
var map = L.map('map').setView([0, 0], 2);
8+
L.tileLayer('https://{s}.tile.osm.org/{z}/{x}/{y}.png', {
9+
attribution: '&copy; <a href="https://osm.org/copyright">OpenStreetMap</a> contributors'
10+
}).addTo(map);
11+
12+
L.Control.geocoder({
13+
geocoder: L.Control.Geocoder.nominatim()
14+
}).addTo(map);

demo-esbuild/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "leaflet-control-geocoder-demo-esbuild",
3+
"private": true,
4+
"scripts": {
5+
"build": "esbuild --bundle --loader:.gif=file --loader:.png=file --outdir=dist/ main.js"
6+
},
7+
"dependencies": {
8+
"leaflet": "^1.5.1",
9+
"leaflet-control-geocoder": "^1.8.0"
10+
},
11+
"devDependencies": {
12+
"esbuild": "^0.8.0"
13+
}
14+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
"module": "src/index.js",
77
"scripts": {
88
"prepare": "npm run build",
9-
"build": "npm run build:js && npm run build:css && npm run build:img && npm run build:demo-rollup && npm run build:demo-webpack",
9+
"build": "npm run build:js && npm run build:css && npm run build:img && npm run build:demo-esbuild && npm run build:demo-rollup && npm run build:demo-webpack",
1010
"build:js": "rollup -c",
1111
"build:css": "cpr Control.Geocoder.css dist/Control.Geocoder.css --overwrite",
1212
"build:img": "cpr images/ dist/images/ --overwrite",
13+
"build:demo-esbuild": "cd demo-esbuild && npm install && npm run build",
1314
"build:demo-rollup": "cd demo-rollup && npm install && npm run build",
1415
"build:demo-webpack": "cd demo-rollup && npm install && npm run build",
1516
"test": "npm run test:karma -- --single-run && npm run lint",

0 commit comments

Comments
 (0)