Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

177
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda