Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

237
Views
'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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!