princejwesley/Mancy

Make it possible to set the working directory to enable relative requires

holyjak opened this issue · 4 comments

I would like to be able to start Mancy from my Node project directory and be able to require files in it (require("./my-project-file.js");). It could either pick up the directory when starting or accept a setting / command line option to set the working directory.

That way, it would be much easier to experiment with an existing project.

(Currently my workaround is to do const root= "/absolute/path/to/project/dir/"; require(root + "my-project-file.js"))

Thank you!

I would be willing to help implement it if you could point me in the right direction (where to look / add it)

@jakubholynet I'll check and let you know. I forgot the reason why I set this

Thanks!

Good messages in commits / comments FTW :)
tir. 21. jun. 2016 kl. 16.48 skrev Prince John Wesley <
notifications@github.com>:

@jakubholynet https://github.com/jakubholynet I'll check and let you
know. I forgot the reason why I set this
https://github.com/princejwesley/Mancy/blob/master/src/main/index.js#L83


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#131 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAmJPiyKgGhUQy3pPyyPVRha0IxzQbz8ks5qN_mfgaJpZM4IzC5Z
.

Try this fix 😄 Its a hack to make it work. While loading relative path, parent module file is set as index.html. Let me see whether there exists a better fix for this problem.

Unfortunately This particular fix is tricky, Its not easy to show direction. Very sorry!!!