I am trying to add a new package called ethaccount to the CosmJS monorepo (https://github.com/cosmos/cosmjs). This package is using generated TS protobuf files. The generated protobuf files have the long and protobufjs packages as dependencies, which I have added using yarn add.
The TS protobuf files are placed in packages/ethaccount/dist/proto directory
The following is the tsconfig.json file in my package:
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"target": "es2015",
"declaration": true,
"esModuleInterop": true,
"outDir": "./dist"
},
"include": [
"src/**/*"
]
}
The package.json for my package is as follows:
{
"name": "@cosmjs/ethaccount",
"version": "1.0.0",
"description": "Exposes EthAccount interface to send txs to Ethermint chain",
"main": "dist/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc"
},
"author": "",
"license": "ISC",
"types": "dist/index.d.ts",
"files": [
"/dist"
],
"dependencies": {
"@cosmjs/proto-signing": "workspace:packages/proto-signing",
"@cosmjs/tendermint-rpc": "workspace:packages/tendermint-rpc",
"google-protobuf": "^3.19.1",
"long": "^5.2.0",
"protobufjs": "~6.10.2"
},
"devDependencies": {
"ts-proto": "^1.87.1"
}
}
However, when I try to run yarn build in the ethaccount directory, I get the following error:
dist/proto/cosmos/auth/v1beta1/auth.ts:2:18 - error TS2307: Cannot find module 'long' or its corresponding type declarations.
import Long from "long";
~~~~~~
dist/proto/cosmos/auth/v1beta1/auth.ts:3:17 - error TS2307: Cannot find module 'protobufjs/minimal' or its corresponding type declarations.
import _m0 from "protobufjs/minimal";
~~~~~~~~~~~~~~~~~~~~
Is there something I'm missing here?