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

144
Views
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
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!