Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

243
Visualizações
Error when building rollup project that has a leaflet map: `this` has been rewritten to `undefined`

When building my LeafletJS project using rollup I get the following error:

(!) `this` has been rewritten to `undefined`
https://rollupjs.org/guide/en/#error-this-is-undefined
node_modules/leaflet/dist/leaflet-src.js
1: /* @preserve
   ^
2:  * Leaflet 1.8.0, a JS library for interactive maps. https://leafletjs.com
3:  * (c) 2010-2022 Vladimir Agafonkin, (c) 2010-2011 CloudMade

This points to the following module definition in the Leaflet code:

(function (global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined'
    ? factory(exports)
    : typeof define === 'function' && define.amd
    ? define(['exports'], factory)
    : ((global =
        typeof globalThis !== 'undefined' ? globalThis : global || self),
      factory((global.leaflet = {})));
})(this, function (exports) {

Is there any way to disable this feature of rollup / babel so that this file will build? I tried replacing the 'this' with 'window' but the build did not work.

My rollup config can be found here: https://github.com/xbgbtx/artist-map-2/blob/main/rollup.config.js

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda