Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Module not found: Error: Can't resolve '@kepler.gl/components' #2842

Open
AlfredoRuizXcaliburmp opened this issue Dec 17, 2024 · 25 comments
Assignees
Labels
bug Something isn't working

Comments

@AlfredoRuizXcaliburmp
Copy link

Describe the bug
Hi there

I'm trying to add kepler.gl to my react project but I can't get it to recognize the module. I've checked that it's in Packjson and Node_modules.

Screenshots
Screenshot from 2024-12-17 07-29-00
Screenshot from 2024-12-17 07-21-40

Desktop (please complete the following information):

  • OS: Windows 11, Linux Ubuntu 22
  • Browser Chrome, Firefox
  • kepler.gl 3.0.0, 3.1.0-alpha.1,
  • react 18,17,16,
  • node 20, 18
@AlfredoRuizXcaliburmp AlfredoRuizXcaliburmp added the bug Something isn't working label Dec 17, 2024
@AlfredoRuizXcaliburmp
Copy link
Author

Screenshot from 2024-12-17 08-41-15
Screenshot from 2024-12-17 08-43-40

Ok, I was using the alpha version of kepler.gl/components but it still doesn't load anything

@AlfredoRuizXcaliburmp
Copy link
Author

Screenshot from 2024-12-17 08-56-25
"More than one copy of react-palm was loaded"

@AlfredoRuizXcaliburmp
Copy link
Author

AlfredoRuizXcaliburmp commented Dec 17, 2024

Now is
WARNING in ./node_modules/@formatjs/fast-memoize/lib/index.js
Module Warning (from ./node_modules/react-scripts/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/workspace/javascript/kepler-demo/node_modules/@formatjs/fast-memoize/index.ts' file: Error: ENOENT: no such file or directory, open '/workspace/javascript/kepler-demo/node_modules/@formatjs/fast-memoize/index.ts'

@igorDykhta
Copy link
Collaborator

igorDykhta commented Dec 24, 2024

Hi @AlfredoRuizXcaliburmp
Could you try with the latest alpha? 3.1.0-alpha.3

@AlfredoRuizXcaliburmp
Copy link
Author

Hi @igorDykhta

It now detects the alpha version of both components and redicers. I still can't get it to show me the base map with either Mapbox or Maplibre and I still get the error that it can't locate the file: /node_modules/@formatjs/fast-memoize/index.ts

Thank you very much and happy holidays

@AlfredoRuizXcaliburmp
Copy link
Author

More than one copy of react-palm was loaded. This may cause problems.

Screenshot from 2024-12-26 10-48-19

@igorDykhta igorDykhta self-assigned this Dec 26, 2024
@igorDykhta
Copy link
Collaborator

Hi @AlfredoRuizXcaliburmp
Just checked the latest alpha and I see the map, and don't see the missing @formatjs error message.

basic-app-with-latest-alpha.zip

@AlfredoRuizXcaliburmp
Copy link
Author

Hi @igorDykhta

Thank you very much for your help.

The error occurs when I run a react.js project locally without build.

@AlfredoRuizXcaliburmp
Copy link
Author

Screenshot from 2024-12-27 10-01-41

@AlfredoRuizXcaliburmp
Copy link
Author

I have found that if I do not use esbuild when loading a dataset I get the following error

Screenshot from 2024-12-30 06-57-19

I understand that it is essential to use esbuild?

Thank you very much, happy holidays and a prosperous new year.

@igorDykhta
Copy link
Collaborator

igorDykhta commented Dec 30, 2024

No, esbuild shouldn't be mandatory.
You can attach your minimal project / config here so I can take a look.

@AlfredoRuizXcaliburmp
Copy link
Author

my-app.zip

I'm playing a little crazy

@AlfredoRuizXcaliburmp
Copy link
Author

Hi, I just noticed that despite passing the MapBox token, it is loading MapLibre and in the demo I see that it is the same.
Screenshot from 2025-01-02 15-31-23
Screenshot from 2025-01-02 15-33-52

@ibgreen
Copy link
Collaborator

ibgreen commented Jan 5, 2025

I believe there is a new config API where your app can configure which basemap to use. I.e. mapbox and maplibre are not both included so that they can be switched dynamically, you need to build your app with one or the other, and maplibre is the default.

@AlfredoRuizXcaliburmp
Copy link
Author

Hi there
I'm using the same configuration as in the demo app.
If it has been changed, could you tell me where I can see the documentation or an example?
Thank you very much and happy new year

@igorDykhta
Copy link
Collaborator

igorDykhta commented Jan 7, 2025

@AlfredoRuizXcaliburmp I don't think there is an example for custom basemap libraries.

You can pass custom configuration to your app like this:
Custom config

To use mapbox you need to pass:

getMapLib: () => import('mapbox-gl'),
mapLibCssClass: 'mapboxgl',
mapLibName: 'Mapbox',
mapLibUrl: 'https://www.mapbox.com/'

I'm trying to restore support for MapLibre and Mapbox in this PR:
#2897

@igorDykhta
Copy link
Collaborator

@AlfredoRuizXcaliburmp In the latest alpha release we added back Mapbox styles to the basemap style dropdown. Let me know how it works for you.

@AlfredoRuizXcaliburmp
Copy link
Author

AlfredoRuizXcaliburmp commented Jan 17, 2025

I'm trying it now, but mostly when I tried to pass the mapboxApiAcessToken prompt to maplibre it informed me that the token was not correct or that it was required.

Image

I'm following the documentation but it keeps loading mapLibre

Image

@andrewm898
Copy link

Hey, did you end up figuring out the parseInBatches is not a function / multiple versions of react-palm issue? I am running into the same thing.

@AlfredoRuizXcaliburmp
Copy link
Author

Very good, in the end we left it stopped. So I couldn't solve the problem.

@igorDykhta
Copy link
Collaborator

@AlfredoRuizXcaliburmp here is a minimal app based on the 3.1 version of kepler.gl and getting-started docs bundled with esbuild, with both MapLibre and Mapbox enabled.

kepler-app-3.1.zip

@AlfredoRuizXcaliburmp
Copy link
Author

@igorDykhta thanks a lot

@andrewm898
Copy link

Is the expected size of the bundle.js files that come from this build 25MB - 48MB ? These files that are being generated are too large to deploy it, is this expected behavior? @igorDykhta

@igorDykhta
Copy link
Collaborator

igorDykhta commented Feb 28, 2025

@andrewm898 Most likely, this isn't expected. I see that the UMD bundle is 12MB. You can open an issue and provide details on how you got these numbers. I'll also investigate later using a bundle analyzer.

@andrewm898
Copy link

This is using the exact code you attached in that .zip file here, same esbuild, yarn.lock etc. I have tried it with and without npm bootstrap first, and with adding --minify, getting 25MB for bundle.js and 43.96 for bundle.js.map

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants