You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in /Users/timdp/Code/depcheck-test/node_modules/miniflare/package.json
at new NodeError (node:internal/errors:393:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:340:9)
at packageExportsResolve (node:internal/modules/esm/resolve:619:3)
at resolveExports (node:internal/modules/cjs/loader:492:36)
at Module._findPath (node:internal/modules/cjs/loader:532:31)
at Module._resolveFilename (node:internal/modules/cjs/loader:941:27)
at Function.resolve (node:internal/modules/cjs/helpers:109:19)
at loadModuleData (/Users/timdp/Code/depcheck-test/node_modules/depcheck/dist/utils/index.js:48:26)
at getCacheOrLoad (/Users/timdp/Code/depcheck-test/node_modules/depcheck/dist/special/bin.js:22:48)
at getBinaries (/Users/timdp/Code/depcheck-test/node_modules/depcheck/dist/special/bin.js:31:23) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
because Miniflare uses ESM exports in package.json, which require.resolve() respects.
Theoretically, Miniflare could export package.json explicitly, but there's no need for that. I would recommend using read-pkg instead of require.resolve() + require().
Versions
node -v: v18.8.0
npm -v: 8.18.0
depcheck --version: 1.4.3
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Bug Description
utils.loadModuleData()
is defeated b yESM packages.Code snippets
This crashes the
require.resolve('.../package.json')
call inloadModuleData
with:because Miniflare uses ESM
exports
in package.json, whichrequire.resolve()
respects.Theoretically, Miniflare could export package.json explicitly, but there's no need for that. I would recommend using read-pkg instead of
require.resolve()
+require()
.Versions
node -v
: v18.8.0npm -v
: 8.18.0depcheck --version
: 1.4.3The text was updated successfully, but these errors were encountered: