Open
Description
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, addimport { 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"
}
}
Metadata
Metadata
Assignees
Labels
No labels