Closed ScriptedAlchemy closed 2 years ago
Maybe https://github.com/chrisveness/geodesy/pull/56/ could be cleaned up.
The reason that I've never included a 'main' entry is that there is a range of independent entry points into the library; while one user might
import LatLon from 'geodesy/latlon-spherical.js';
or
import LatLon from 'geodesy/latlon-ellipsoidal-vincenty.js';
another user might
import Mgrs, { LatLon } from 'geodesy/mgrs.js';
I'm afraid I've no experience with Next or indeed React – why is it next-transpile-modules requires a main
entry?
The main field can point to an empty module export. It's just require.resolve and enhanced-handed resolve won't work without a valid field available.
Looking through these:
I gather that webpack respects both "main"
and "module"
, and that "main"
is more used for CommonJS and "module"
for ESM ("with package.json "main" specifying the CommonJS entry point and package.json "module" specifying the ES module entry point") – and also that "module"
can "point to a folder of ES modules".
So it appears to me that a package.json entry
"module": "./"
would be correct and accurate, and would satisfy webpack's resolve requirements – have I understood well?
If so, I would be more than happy to include that.
I've added "module": "./"
to package.json in v2.3.0, which I hope resolves this issue.
Much appreciated
Im having some nightmare issues trying to resolve this project with next-transpile-modules
Is it possible to please add some kind of index.js file so require.resolve is able to find the package properly