dividab / tsconfig-paths

Load node modules according to tsconfig paths, in run-time or via API.
MIT License
1.8k stars 100 forks source link

Cannot import package that uses .cjs entry #192

Closed aleclarson closed 2 years ago

aleclarson commented 2 years ago
import 'tsconfig-paths/register'
import { open } from 'lmdb'

Error: Cannot find module '~/node_modules/lmdb/dist/index'

The exports field of lmdb looks like this:

  "type": "module",
  "main": "dist/index.cjs",
  "module": "index.js",
  "exports": {
    ".": {
      "node": {
        "require": "./dist/index.cjs",
        "import": "./node-index.js"
      },
      "default": "./index.js"
    }
  },
aleclarson commented 2 years ago

I can confirm that #139 fixes this issue

jonaskello commented 2 years ago

@aleclarson Does this work now in 3.13.0?

aleclarson commented 2 years ago

Yes, thank you!