react-mapkit icon indicating copy to clipboard operation
react-mapkit copied to clipboard

Error importing with Vite

Open cesargdm opened this issue 3 years ago • 8 comments

If using vite, import cannot be possible.

Failed to resolve entry for package "react-mapkit". The package may have incorrect main/module/exports specified in its package.json.
Plugin: vite:import-analysis

cesargdm avatar Nov 05 '22 17:11 cesargdm

@cesargdm I've been having the same problem when importing with yarn. Think I've found a temporary fix: Go to /node_modules/react-mapkit/package.json. Change line 23 to "module": "dist/react-mapkit.cjs.production.min.js",. This seemed to fix it for me, and now the import works and I can get the map to display.

jakedarby24 avatar Dec 06 '22 14:12 jakedarby24

No issues with Vite here! Here's my repo if that helps: https://github.com/bnussman/beep/tree/main/website

bnussman avatar Aug 12 '23 16:08 bnussman

Having the same issue with Vite v4.4.9.

Failed to resolve entry for package "react-mapkit". The package may have incorrect main/module/exports specified in its package.json.
Plugin: vite:import-analysis

doubleforte avatar Aug 15 '23 05:08 doubleforte

I'm not familiar with vite, so I'm not sure whats up. Did anyone check out @bnussman's repo?

chrisdrackett avatar Aug 15 '23 05:08 chrisdrackett

Vite is a replacement for the dead/dying create-react-app. It's gaining lots of popularity.

I looked at @bnussman's repo. Looks like they are using a different package (mapkit-react vs react-mapkit)

https://github.com/bnussman/beep/blob/39849cb8fe6e8912d9b11ded1bcdb87707cfe758/website/package.json#L25

I've made a very simple project using Vite and react-mapkit to demonstrate the issue. Clone and run (instructions in the README) and you'll see the crash.

https://github.com/doubleforte/mapkit-example

doubleforte avatar Aug 15 '23 16:08 doubleforte

OMG!! I'm so sorry

bnussman avatar Aug 15 '23 18:08 bnussman

I hope to look at this soon, but until my kids are back at school my free time has been less than ideal :)

chrisdrackett avatar Aug 15 '23 19:08 chrisdrackett

Any progress on this one?

doubleforte avatar Dec 13 '23 23:12 doubleforte