terrestris / react-geo

A set of geo related modules to use in combination with React, Ant Design and OpenLayers.
https://terrestris.github.io/react-geo/
BSD 2-Clause "Simplified" License
362 stars 57 forks source link

[Bug]: Bad import on SimpleButton.js #3981

Open RiccardoRossiMori opened 3 weeks ago

RiccardoRossiMori commented 3 weeks ago

Current Behavior

When importing the SimpleButton into my project following your tutorial, it gives me the error linked below.

Expected Behavior

Is not expected to give me an error and show the Button properly.

Steps To Reproduce

Follow the tutorial at this link "https://terrestris.github.io/react-geo-ws/latest/react-geo-ws/first-steps/erste-komponente.html" where you try to add the related component to your project.

Version

16.2.0

What browsers are you seeing the problem on?

No response

Relevant log output

ERROR in ./node_modules/@terrestris/react-geo/dist/Button/SimpleButton/SimpleButton.js 3:0-45
Module not found: Error: Can't resolve '../../constants' in 'D:\CodingWorkspace\myproj\my-app\node_modules\@terrestris\react-geo\dist\Button\SimpleButton'
Did you mean 'constants.js'?
BREAKING CHANGE: The request '../../constants' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

Anything else?

No response

Code of Conduct

dnlkoch commented 1 week ago

Thanks for your report @RiccardoRossiMori!

I fear the workshop hasn't been tested against the latest version of react-geo yet and I guess some additional config for the bundler is needed since we changed the module type. As I'm not sure if and when we'll update the workshop materials, I would suggest you to take a look at the react-geo-client-template application meanwhile. It'll give you some good insights in how to make use of the library in a project.

RiccardoRossiMori commented 1 week ago

Don't mention it, @dnlkoch !

Unfortunately I already started my Thesis project with the plain OpenLayers and I'm about to get my degree. It would have been amazing to use your library instead. I'll probably take a look at it after I've got my degree in my pocket and I'll try to switch.

Best regards, Riccardo Rossi Mori.