manuelbieh / geolib

Zero dependency library to provide some basic geo functions
MIT License
4.23k stars 341 forks source link

Warning: require() of ES modules is not supported #226

Closed t3rminus closed 4 years ago

t3rminus commented 4 years ago

I'm aware this is just a warning, but it's definitely something that should be resolved before it breaks in future node versions.

When launching my app, I get the following warning:

(node:2327) Warning: require() of ES modules is not supported.
require() of /node_modules/geolib/lib/index.js from /mixins/location-mixin.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /node_modules/geolib/package.json.

At this point, it doesn't appear to impact functionality, but it would be nice to see this resolved.

manuelbieh commented 4 years ago

It was a bug because I've set type: module in package.json. This should be solved in v3.2.1+