Skip to content

Commit a18de1c

Browse files
committed
Add BingLayer component for enhanced map functionality
- Introduced a new BingLayer component to integrate Bing Maps with Leaflet. - Updated SourcedTileLayer to import the new BingLayer instead of the previous package. - This change improves compatibility with the current build system and resolves import issues with react-leaflet-bing-v2.
1 parent 604d70f commit a18de1c

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { createLayerComponent } from "@react-leaflet/core";
2+
import L from "leaflet";
3+
4+
// Side-effect import: registers L.BingLayer / L.bingLayer on the Leaflet global.
5+
// We intentionally bypass react-leaflet-bing-v2's own Bing.js wrapper, which does
6+
// `import {bingLayer} from './leaflet.bing'` — a binding that file never exports.
7+
// Older bundlers ignored the dead import; Vite/rolldown rejects it as MISSING_EXPORT.
8+
import "react-leaflet-bing-v2/src/leaflet.bing.js";
9+
10+
const createLeafletElement = (props) => {
11+
const instance = L.bingLayer(props.bingkey, props);
12+
return { instance };
13+
};
14+
15+
export const BingLayer = createLayerComponent(createLeafletElement);

src/components/EnhancedMap/SourcedTileLayer/SourcedTileLayer.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import PropTypes from "prop-types";
33
import { useEffect, useState } from "react";
44
import { FormattedMessage, injectIntl } from "react-intl";
55
import { TileLayer } from "react-leaflet";
6-
import { BingLayer } from "react-leaflet-bing-v2/src/index.js";
6+
import { BingLayer } from "./BingLayer";
77
import AppErrors from "../../../services/Error/AppErrors";
88
import {
99
defaultLayerSource,

0 commit comments

Comments
 (0)