shaack / cm-pgn

Parse and create PGNs (Portable Game Notation for chess games)
MIT License
27 stars 21 forks source link

Unable to import in typescript project #23

Open MarkShurmer opened 3 months ago

MarkShurmer commented 3 months ago

I've been trying to use your pgn parser from typescript, as it looks very good for parsing PGNs

I have a typescript project set up , using next.js and vitest

I am using ESM modules, so that shouldn't be a problem.

The error I get is: Error: Failed to resolve entry for package "cm-pgn". The package may have incorrect main/module/exports specified in its package.json.

I wonder if it is due to the main section of your package.json being thus: "main": "src/cm-pgn/Pgn.js" When maybe it should be "main": "src/Pgn.js"

I'm happy to create a PR

shaack commented 3 months ago

Yes, this is wrong in the package.json. Would be great if you create a PR which makes it working with TypeScript. 👍 I am not 100% sure what the "main" entry in the package.json is for but "src/Pgn.js" seems to be the right setting for me. The folder "/cm-pgn" was deleted in former versions.