hapijs / glue

Server composer for hapi.js
Other
245 stars 62 forks source link

Relative paths are bugged #11

Closed gagle closed 9 years ago

gagle commented 9 years ago

You can't use a relative path to require a module from inside a module that will be stored in the node_modules folder. If you have a manifest with a path ./my-plugin, this will be resolved to require('<...>/node_modules/glue/my-plugin') because relative path used with require() are relative to the __dirname.

The solution is to use join the process.cwd to the relative paths:

path = Path.join(process.cwd(), path);
csrl commented 9 years ago

You can set the 'relativeTo' option to the path that you want to load the plugins relative to using the output of the code you provided.

lock[bot] commented 4 years ago

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.