Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jsonwebtoken don't support verbatimModuleSyntax typescript compiler option #942

Open
gillesdalle opened this issue Sep 28, 2023 · 0 comments

Comments

@gillesdalle
Copy link

Description

When the verbatimModuleSyntax typescript compiler option is set to true, the import of jsonwebtoken raise an error on runtime Cannot read properties of undefined (reading 'from')

In my tsconfig.json file, I extend the @vue/tsconfig/tsconfig.dom.json file. The verbatimModuleSyntax comes from here.

Reproduction

  • Create a new project with Vite with Vue
  • import jsonwebtoken @types/jsonwebtoken @vue/tsconfig librairies
  • In the mains.ts file, add import { decode } from "jsonwebtoken";
  • In tsconfig.json file, add "extends": "@vue/tsconfig/tsconfig.dom.json"
  • Run npm dev

Environment

package.json

{
  "name": "vite-project",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vue-tsc && vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "@types/jsonwebtoken": "^9.0.3",
    "@vue/tsconfig": "^0.4.0",
    "jsonwebtoken": "^9.0.2",
    "vue": "^3.3.4"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^4.2.3",
    "typescript": "^5.0.2",
    "vite": "^4.4.5",
    "vue-tsc": "^1.8.5"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant