Cainier / gpt-tokens

Calculate the token consumption and amount of openai gpt message
MIT License
104 stars 13 forks source link

Import is broken #40

Closed tro9999 closed 5 months ago

tro9999 commented 7 months ago

After upgrading new release I started to get import errors.

{ "errorType": "Error", "errorMessage": "Cannot find module '/var/task/node_modules/gpt-tokens/dist/index.ts' imported from /var/task/index.js\nDid you mean to import gpt-tokens/dist/index.js?", "code": "ERR_MODULE_NOT_FOUND", "url": "file:///var/task/node_modules/gpt-tokens/dist/index.ts",

It looks like package.json export has wrong dist file for "import", should be index.d.ts "exports": { ".": { "import": "./dist/index.ts",

Previous version 1.2.0 works well.

Cainier commented 7 months ago

This is indeed a serious issue, thanks for your feedback

I fixed this issue in v1.3.3

...
"exports": {
        ".": {
          "types": "./dist/index.d.ts",
          "import": "./dist/index.js",
          "require": "./dist/index.js"
        }
    }
...