alex3165 / react-leaflet-draw

React component for leaflet-draw on top of react-leaflet
228 stars 152 forks source link

Can't resolve '@react-leaflet/core' error #100

Open mohd-akram opened 3 years ago

mohd-akram commented 3 years ago

Getting this error in my build:

ERROR in ./node_modules/react-leaflet-draw/dist/esm/EditControl.js
Module not found: Error: Can't resolve '@react-leaflet/core' in '/home/mohamed/Development/project/node_modules/react-leaflet-draw/dist/esm'
 @ ./node_modules/react-leaflet-draw/dist/esm/EditControl.js 12:0-56 30:16-33
 @ ./node_modules/react-leaflet-draw/dist/esm/index.js
 @ ./src/components/rich/map.tsx
 @ ./src/components/rich/index.ts
 @ ./src/index.tsx

It seems @react-leaflet/core is being used but isn't declared in package.json.

ThiefMaster commented 3 years ago

Looks like #90 started requiring react-leaflet v3. This PR should have been a major version bump, ie 0.19 to 0.20 since this project is still in the 0.x versions.

And thanks to the lack of a changelog (or at least git tags!) it's not even straightforward to figure out which version I need to pin to avoid this breaking change.

ThiefMaster commented 3 years ago

Looks like the solution is to pin 0.19.0 (exact version) when you are using react-leaflet v2

FredChauviere commented 3 years ago

Hi Thief, thank you for your analysis. What do you mean by "pin 0.19.0"? I've got the 0.19.0 declared in my package.json, but it seems that when I do a npm install --production --force, it still install the 0.19.7 by default...

ThiefMaster commented 3 years ago

are you sure you have "0.19.0" and not "^0.19.0"?

FredChauviere commented 3 years ago

You're right I got "^0.19.0"? Thanks to you, I discover the difference between the two. I understand now what you mean by "pin". Learning new things everyday!

For other noobs like me, the documentation is there: https://docs.npmjs.com/cli/v7/configuring-npm/package-json#dependencies

agnoam commented 3 years ago

Hey, I'm using react@17.0.2 created by create-react-app. Because of an issue in react-leaflet I'm using @monsonjeremy/react-leaflet package.

When I'm trying to install this package, I get the same error as you get. Any help please ?

FredChauviere commented 3 years ago

I'm currently using the last released version of react-leaflet (3.2.1) with the last released version of react-leaflet-draw (0.19.8) and I've got no problem at all, so it seems that the problem comes from @monsonjeremy/react-leaflet

Wills-dev commented 2 years ago

I'm trying to install react-leaflet, but I keep getting npm ERR! code ERESOLVE. @FredChauviere please do you have any solution to this?

FredChauviere commented 2 years ago

Unfortunately, in the meantime, I had to rollback to react-leaflet@2.6.1 for performance reason, so I'm really not up to date on the react-leaflet packages anymore... I'll keep you updated if I find time to migrate to the latest version and benchtest it.

Wills-dev commented 2 years ago

Thank you, I appreciate

On Tue, Apr 19, 2022, 2:24 PM FredChauviere @.***> wrote:

Unfortunately, in the meantime, I had to rollback to @.*** for performance reason, so I'm really not up to date on the react-leaflet packages anymore... I'll keep you updated if I find time to migrate to the latest version and benchtest it.

— Reply to this email directly, view it on GitHub https://github.com/alex3165/react-leaflet-draw/issues/100#issuecomment-1102647476, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOSGIMP7Z4BPSV757OFWSTTVF2XYJANCNFSM42XQ54OA . You are receiving this because you commented.Message ID: @.***>