iamanvesh / mapbox-gl-draw-circle

Supports drawing/editing a circle on a Mapbox map.
https://iamanvesh.github.io/mapbox-gl-draw-circle-test/
MIT License
74 stars 59 forks source link

New update: error during compiling in node modules #8

Open ev0065 opened 5 years ago

ev0065 commented 5 years ago

Hi,

I just updated the packages and received a new error:

/node_modules/mapbox-gl-draw-circle/lib/modes/CircleMode.js
Module parse failed: Unexpected token (6:20)
You may need an appropriate loader to handle this file type.
| const circle = require('@turf/circle').default;
| 
| const CircleMode = {...MapboxDraw.modes.draw_polygon};
| const DEFAULT_RADIUS_IN_KM = 2;
|

In my actual code, I am getting this error when I try to import it:

module "/home/user/workspace/node_modules/mapbox-gl-draw-circle/index" Could not find 
a declaration file for module 'mapbox-gl-draw-circle'. 
'/home/user/workspace/node_modules/mapbox-gl-draw-circle/index.js' implicitly 
has an 'any' type. 

Try `npm install @types/mapbox-gl-draw-circle` if it exists or add a new declaration 
(.d.ts) file containing `declare module 'mapbox-gl-draw-circle';`ts(7016)

I wanted to check and see if I was the only one receiving these errors or if my build somehow got screwed up. I did update the other modules that mapbox-gl-draw-circle uses but it didn't work.

iamanvesh commented 5 years ago

Are you using typescript? Looks like its complaining because I don't have a declaration file for the module. Can you try adding a declaration file?

ev0065 commented 5 years ago

@iamanvesh So adding a declaration file with declare module 'mapbox-gl-draw-circle does not work. I'm still getting the same error as before when compiling. I do not believe that I am using typescript. I am currently using react-mapbox-gl and as well as other wrappers, mainly this one and mapbox draw. Do you have an idea why?

iamanvesh commented 5 years ago

@evan0065 Can you share your package.json configuration and some parts of your code to reproduce this issue?

ajithes111 commented 4 years ago

+1

moory commented 3 years ago

How to solve it?

moory commented 3 years ago
`./node_modules/mapbox-gl-draw-circle/lib/modes/CircleMode.js Module parse failed: /Users/laoma/Documents/moory/2020.04/bird-map/node_modules/mapbox-gl-draw-circle/lib/modes/CircleMode.js Unexpected token (6:20) You may need an appropriate loader to handle this file type. const circle = require('@turf/circle');
const CircleMode = {...MapboxDraw.modes.draw_polygon};
const DEFAULT_RADIUS_IN_KM = 2;

`

molinto commented 1 year ago

@moory Did you find a solution to this please?

Getting:~ "Could not find a declaration file for module 'mapbox-gl-draw-circle'. '/home/sharry/frontend/node_modules/mapbox-gl-draw-circle/index.js' implicitly has an 'any' type."

mbrammer commented 1 year ago

If you are using TypeScript, add declare module 'mapbox-gl-draw-circle'; to your typings.d.ts.

shivalika-techp commented 1 month ago

@iamanvesh Thanks for building this library for circle support in mapbox-draw-gl. I am facing the same issue while working withReact 17.0.2 in Typescript Import statement for CircleMode, DragCircleMode, DirectMode and SimpleSelectMode is throwing the following error:

Could not find a declaration file for module 'mapbox-gl-draw-circle'. 'c:/Users/fe/node_modules/mapbox-gl-draw-circle/index.js' implicitly has an 'any' type. Try npm i --save-dev @types/mapbox-gl-draw-circle if it exists or add a new declaration (.d.ts) file containing declare module 'mapbox-gl-draw-circle';ts(7016)

These are the versions of the libraries that I am using:

"@mapbox/mapbox-gl-draw": "^1.3.0",
"mapbox-gl-draw-circle": "^1.1.2",

It would be helpful if you could suggest a solution to this issue and make the library work for my application. Thank you!

iamanvesh commented 1 month ago

@ev0065 @shivalika-techp I'm not actively maintaining this library. I'll try and take a look at this issue this weekend, but feel free to clone and submit a PR for the fix.

shivalika-techp commented 1 month ago

@ev0065 @shivalika-techp I'm not actively maintaining this library. I'll try and take a look at this issue this weekend, but feel free to clone and submit a PR for the fix.

There is an open PR for updating mapbox-gl-draw support for this library, merging this will also be helpful- https://github.com/iamanvesh/mapbox-gl-draw-circle/pull/61