leaflet with GitHub URL in package.json

Viewed 83

I need an unreleased upstream fix in leaflet.

If I switch leaflet to use GitHub URL in my package.json:

"leaflet": "github:Leaflet/Leaflet#main",

Then I get this error starting my React app:

Failed to compile.

./node_modules/@react-leaflet/core/lib/dom.js
Module not found: Can't resolve 'leaflet' in '/workspaces/jefmap/node_modules/@react-leaflet/core/lib'
1 Answers

This happens because because the main file for leaflet (dist/leaflet-src.js) is not checked in to the GitHub repo.

I was able to work around by:

  1. Fork the leaflet repo

  2. Checkout the fork and run npm run build

  3. Add the files with git add -f dist/

  4. Change package.json to use the fork:

    "leaflet": "JEFuller/Leaflet#main",
    

Issue on leaflet repo to address this.

Related