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
72 stars 57 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.