auth70 / paseto-ts

PASETO v4 (encrypt, decrypt, sign & verify) in TypeScript
MIT License
19 stars 6 forks source link

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v4' is not defined by "exports" #3

Closed Extarys closed 11 months ago

Extarys commented 1 year ago

My current project refuses to start because of that error, therefore I tried

Still having the issue. I created a new empty package outside the monorepo with Yarn.

index.ts

import { generateKeys } from 'paseto-ts/v4';

const localKeyBuffer = generateKeys('local');

package.json

{
  "name": "test",
  "version": "1.0.0",
  "license": "MIT",
  "dependencies": {
    "paseto-ts": "^1.4.3",
    "ts-node": "^10.9.1",
    "typescript": "^5.1.5"
  },
  "scripts": {
    "dev": "ts-node --transpile-only index.ts"
  }
}

I get the same error. :crying_cat_face: Tested with Node v18.14.2 and v19.9.0, paseto-ts v1.3.0 and 1.4.3.

It's probably not your package, as I could use it previously, but is there something that comes to mind? I'm at a loss and a web search didn't reveal much, except the steps I already tried. I need the local variant your package implements as it's the only one supporting it :)

miunau commented 1 year ago

Hi, Here's a codesandbox link that works fine: https://codesandbox.io/s/typescript-playground-export-forked-9yplpy?file=/index.ts

Could it be something about ts-node? I don't use it myself. You might also want to try declaring your project as a module in package.json ("type": "module")

miunau commented 11 months ago

Hi, I'm going to close this as I can't replicate but please feel free to reopen with a test case.