Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

202
Views
How to do module resolution when an npm package contains multiple namespaces/submodules

A project I am working with is using this package: https://www.npmjs.com/package/@ethersproject/abstract-provider within an SDK we are building..

After installation, the SDK node_modules folder contains the @ethersproject directory which contains an abstract-provider directory as well as multiple other directories, each their own namespace with separate package.json files.

We use the code in the sdk as follows: import { Provider } from '@ethersproject/abstract-provider'; and this works fine for webpack based projects which import our SDK (such as a React app using create-react-app).

When I want to use our SDK in a project which DOESN'T use a bundler such as webpack (such as a very simple frontend pulling in our sdk with importmap as here: https://github.com/unegma/rainprotocol__verify-gating), we are getting an error:

Failed to resolve module specifier "@ethersproject/abstract-provider". Relative references must start with either "/", "./", or "../".

I'm assuming this is because our SDK doesn't know how to resolve @ethersproject/abstract-provider because abstract-provider is a submodule of @ethersproject (which isn't even a module itself).

What is the way to solve this issue? Do we need to create a decs.d.ts file in our SDK root which contains something like: declare module "@ethersproject/abstract-provider; or is there a different way to do this?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!