@types/node
should be moved to devDependencies
#4949
Labels
@types/node
should be moved to devDependencies
#4949
Ethers Version
6.x.x
Search Terms
devDependencies
Describe the Problem
Hey,
This package has
@types/node
is independencies
instead ofdevDependencies
. This was apparently added to fix Angular build issues in #3910, but I think that might not be the best solution.Type definitions are only used during development and compilation - they serve no purpose in production builds. When users install ethers with
npm i --omit=dev
, they shouldn't need to download these type files.I get the backwards compatibility concerns (#4893 (comment)) BUT, the errors mentioned in #3910 signaled by typescript and occur during development/build time when
devDependencies
are available anyway. If a project has issues with types, it's likely a configuration problem in that project that should be fixed upstream, rather than forcing all users to include type definitions in their production builds.For that Angular project specifically, I tried to run the repo from #3910 (comment)
For that I needed to dedupe some dependencies in package.json and roll back
ethers.js
to the version prior to the "fix":I was able to compile the repo after changing:
tsconfig.json
:"moduleResolution": "node16"
"type": "module"
Proposed solution
I understand that not every project can change moduleResolution to
node16
ornodenext
so maybe the actual solution should be getting rid ofresolution-mode
in/// <reference types="node" resolution-mode="require"/>
oftypes/providers/provider-ipcsocket.d.ts
?As per this microsoft/TypeScript#56592 (comment)
perhaps we can try import from "node:net" here:
ethers.js/src.ts/providers/provider-ipcsocket.ts
Lines 1 to 8 in 0195f44
The text was updated successfully, but these errors were encountered: