zandaqo / structurae

Data structures for high-performance JavaScript applications.
MIT License
701 stars 21 forks source link

Import error in node/typescript project (No "exports" main defined in .../structurae/package.json) - 4.0.x #29

Closed kloshih closed 2 years ago

kloshih commented 2 years ago

Thanks for making your work on structurae available.

Issue

I'm running into the following when using in a node / typescript project

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /tmp/structurae-test/node_modules/structurae/package.json
    at new NodeError (node:internal/errors:371:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:453:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:669:7)
    at resolveExports (node:internal/modules/cjs/loader:482:36)
    ...

Steps to Reproduce

zandaqo commented 2 years ago

The issue is with Mocha's handling of ESM: https://stackoverflow.com/questions/64261239/mocha-tests-with-esm-support-for-native-es6-modules