anchorme.js icon indicating copy to clipboard operation
anchorme.js copied to clipboard

Cannot import correctly under TypeScript Node 16 module resolution

Open Jack-Works opened this issue 2 years ago • 2 comments

🐛 Bug Report

Under TypeScript Node 16 module resolution (has type: module in the package.json and moduleResolution: Node16 in tsconfig.json), this package cannot be imported correctly.

image

To Reproduce

import anchorme from 'anchorme'
anchorme.list("")

package.json

{ "type": "module" }

tsconfig.json

{
    "compilerOptions": {
        "moduleResolution": "Node16"
    }
}

Observed behavior

Cannot be imported.

Expected behavior

Imported correctly.

Environment

  • 3.0.4

Jack-Works avatar Apr 19 '23 04:04 Jack-Works

Please check the latest version 3.0.7

alexcorvi avatar Apr 08 '24 08:04 alexcorvi

@alexcorvi thanks for your work! But I'm afraid it's still incorrect:

img
import anchorme from 'anchorme'

console.log(anchorme) // This expression is not callable.
console.log(anchorme.list) // TypeScript error, but works with webpack
console.log(anchorme.default.list) // TypeScript no error, but crashes after webpack

Jack-Works avatar Apr 15 '24 06:04 Jack-Works