Commit cb2bf9ae authored by Juan Gomez's avatar Juan Gomez
Browse files

fix: 🐛 Save L on the window or global object so that plugins that expect it to...

fix: 🐛 Save L on the window or global object so that plugins that expect it to be there continue to work
parent 178b4e9e
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -21,6 +21,11 @@ import {
  setup as componentSetup,
} from "../functions/component";

const WINDOW_OR_GLOBAL =
  (typeof self === "object" && self.self === self && self) ||
  (typeof global === "object" && global.global === global && global) ||
  this;

export default {
  props: {
    ...componentProps,
@@ -210,8 +215,15 @@ export default {
    };

    onMounted(async () => {
      window.L = window.L || (await import("leaflet"));
      const { map, CRS, Icon, latLngBounds, latLng, DomEvent } = window.L;
      WINDOW_OR_GLOBAL.L = WINDOW_OR_GLOBAL.L || (await import("leaflet"));
      const {
        map,
        CRS,
        Icon,
        latLngBounds,
        latLng,
        DomEvent,
      } = WINDOW_OR_GLOBAL.L;
      options.beforeMapMount && (await options.beforeMapMount());

      await resetWebpackIcon(Icon);