I'm facing this issue in Webstorm
SyntaxError: The requested module '@dydxprotocol/v4-client-js' does not provide an export named 'LocalWallet'
My code is very liminal:
import {LocalWallet} from "@dydxprotocol/v4-client-js";
I compile my code with npx tsx index.ts
.
The dependency was added with npm i --save-dev @dydxprotocol/v4-client-js
. I also tried it without the --save-dev
option, it's the same.
Below are my package.json
{
"devDependencies": {
"@dydxprotocol/v4-client-js": "^1.13.0",
"tsx": "^4.19.2",
"typescript": "^5.7.2"
},
"dependencies": {
"ts-node": "^10.9.2"
},
"main": "src/index.ts",
"type": "module"
}
and tsconfig.json
{
"compilerOptions": {
"include": ["src/**/*.ts"],
"target": "es2022",
"lib": ["es2022"],
"moduleDetection": "force",
"module": "NodeNext",
"moduleResolution": "node",
"resolveJsonModule": true,
"allowJs": true,
"sourceMap": true,
"outDir": "./build",
"isolatedModules": true,
"verbatimModuleSyntax": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"skipDefaultLibCheck": true,
"skipLibCheck": true
}
}
I know similar issues have been discussed already but I am really stuck so any help would be greatly appreciated.
Finally fixed it, I think it was coming from a misconfiguration of Webstorm. I followed the doc on Jetbrain's website. In particular I took the time to properly configure Language Services
for TypeScript and run configuration, I use ts-node
on the produced JS code.
There seems to be no need to use npx tsc --init
, to generate the package.json
and tsconfig.json
one can simply create the files from the Project window.