Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

203
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda