1
votes

package.json

"exports": {
    "node": {
      "import": "./edition-es5-esm/index.js",
      "require": "./edition-es5/index.js"
    }
},

use

import versionCompare from 'version-compare';
// Error

Module not found: Error: Package path . is not exported from package

1

1 Answers

1
votes

Are you using workspaces? Are you using npm? yarn? pnpm? Are you using typescript? Pure ESM or mixed in CJS? Do you have any custom configurations set about import path resolution?

Lots of questions here, but overall, it seems like you may be trying to emulate behavior of a monorepo (management tool) like lerna or similar

I think this page in node's docs may also help with understanding what this field does, and how to make it work like I presume you want! :)