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

180
Visualizações
How to prevent Typescript from looking in parent node_modules folder

I've got an NPM package inside an another NPM package. The child package has some code like import { range } from 'iter-tools'. Even though the child package.json does NOT have a dependency for iter-tools, I am NOT getting any kind of Typescript compile error. Presumably this is because the module resolver / tsc is walking up to the parent node_modules folder to look for the dependency and finding it there. I do NOT want this to happen. I want to be given an error that I've forgotten to include iter-tools in the local child's dependency list. In other words, I want the child package to be somewhat self-contained. I can't figure out how to make this happen. I've done a lot of Googling and found similar questions but can't find an answer. Is there something I need to add to tsconfig.json or package.json?

The context of this question is I've got an Angular + Firebase repo. One of the server pieces is Firebase cloud functions - FCF. This lives in a functions folder with its own package.json, and this is a child folder of the project set up by the Angular CLI. I've had trouble deploying the FCF unless ALL the code it needs is contained within the FCF folder. Deployment won't work if some of the code and type definitions are grabbed in a higher-level node_modules folder, like in the Angular root. I want to get a compile error if I've forgotten to include a dependency in the package.json of FCF. Instead I don't get any compile error and just a deployment error.

My project also has a local NPM package with code that is shared between client and server and I want to ensure that package is self-contained - not reliant on a package.json file in a parent folder.

over 4 years ago · Santiago Trujillo
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