I made an npm module
, this module export a function that load a json
file and then export the result ( a little bit simplified )
The probleme is when I import this module
inside another project I have this error :
no such file or directory, open 'C:\Users\{my_username}\github\{name_of_the_project}\file.json'
I looks like when I import my module, it try to read the json
inside the current directory and not inside the npm module
.
The code inside my module :
export default function() {
return readFile('./swagger.json')
.then(data => JSON.parse(data))
}