How to configure webpack for path resolver to use dependency which is an internal dependency of another dependency?

Viewed 35

I have a project (named xProject) setup as depicted in images below. As we can see a module named utils.js under commons/ is importing uuid module but it is not installed as a dependency in commons/pacakge.json. I have added commons as dependency in web/package.json: "commons": "file:../commons". When I import utils.js into a module MyModule.tsx under web/, it complains about following ERROR:

ERROR in ../commons/utils.js
Module not found: Error: Can't resolve 'uuid' in '/Users/xuser/myfolder/xproject/commons/'

I want webpack to use uuid from other dependencies whose internal dependency is 'uuid'. Is it possible? If yes, how? For example, node-sass is a package which has uuid as an internal dependency.

I did look for the solution whole last day but unfortunately I didn't get it working.

Thank you in advance for your help.

enter image description here

enter image description here

0 Answers
Related