JSONPath-Plus / JSONPath

A fork of JSONPath from http://goessner.net/articles/JsonPath/
Other
963 stars 169 forks source link

node fails with loading module with 5.0.0 #143

Closed cburgmer closed 3 years ago

cburgmer commented 3 years ago

Describe the bug

node fails with loading module with 5.0.0

Code sample or steps to reproduce

Code is in https://github.com/cburgmer/json-path-comparison/tree/master/implementations/JavaScript_jsonpath-plus albeit in a working version with ^4.0.0.

Console error or logs

node:internal/modules/cjs/loader:479
      throw e;
      ^

Error [ERR_INVALID_PACKAGE_TARGET]: Invalid "exports" main target "dist/index-node-umd.js" defined in the package config ./node_modules/jsonpath-plus/package.json; targets must start with "./"
    at new NodeError (node:internal/errors:278:15)
    at throwInvalidPackageTarget (node:internal/modules/esm/resolve:340:9)
    at resolvePackageTargetString (node:internal/modules/esm/resolve:368:5)
    at resolvePackageTarget (node:internal/modules/esm/resolve:405:12)
    at resolvePackageTarget (node:internal/modules/esm/resolve:451:26)
    at packageExportsResolve (node:internal/modules/esm/resolve:506:22)
    at resolveExports (node:internal/modules/cjs/loader:473:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:513:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:911:27)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27) {
  code: 'ERR_INVALID_PACKAGE_TARGET'
}

Environment (IMPORTANT)

Tested with $ node --version v12.18.2 and $ node --version v15.5.1

brettz9 commented 3 years ago

Should be fixed in 5.0.1. Was working for ESM, but sorry for the significant glitch for CJS and thanks for the report!