Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

242
Vistas
'L' refers to a UMD global, but the current file is a module. Consider adding an import instead

I am trying to use plain TypeScript to write a very simple script that creates a Leaflet map on my website and fills it with data. I am not using any frameworks, so the Leaflet map is loaded with a <script> tag in the website page's head. The L object is then available in every other script on the page.

The script I am writing in TypeScript references this L object, but it keeps showing me an error 'L' refers to a UMD global, but the current file is a module. Consider adding an import instead. for every usage of L in the script. The script compiles with ESBuild to JavaScript fine however, and it works on my website perfectly fine too.

Example snippet of code I am using:

const map = L.map('map').setView([51.505, -0.09], 13);

L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

What does this error mean exactly?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda