Accessing files of root project from a react package (or from node_modules package) in React JS

42 Views Asked by At

I am trying to build a react package. In the package I want to access a json file (or multiple files from a folder) from src of the root project.

my_project  
|  
|----node_modules  
|    |  
|    |----my_package
|    |    |
|    |    |-----index.js //here i want to import file src/config.json
|    |
|----src
|    |----config.json
|    |----App.js
|----otherfile1
|----otherfile2

Really stuck on this for days.

Relative path option like "../../" from node_modules to src is not working

Also tried to use path library but not able to use that in react

0

There are 0 best solutions below