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

146
Vistas
Webpack, change node_modules lookup order

In my project (project A) I have a webpack alias to the directory in the neighboring project (project B, outside of the project A directory). Both of them have own node_modules.

When in project A I import some file from project B that has an import of some library then it still gets imported from projectB/node_modules. I want this to be imported from projectA/node_modules.

- projectA
  - src/file1.ts (imports 'dirB/file2' from project B, which leads to 'react' library for 'file2' to be imported from project B)
  - dirB (webpack alias to 'projectB/dir')
  - node_modules/react
- projectB
  - dir/file2.ts (imports 'react' library)
  - node_modules/react

A solution that I see it to tell webpack that for files in projectB start node_modules resolution as if they were located in projectA somehow. How can I achieve this?

I know this is a dirty setup and I really should do packages/npm link, but this is how it is, I just want to temporarily reuse some files within projectB but without copypasting them (but the result should be as if I did copypaste). Tried creating a symlink instead of webpack alias - the issue remains the same.

about 4 years ago · Juan Pablo Isaza
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