inxilpro / node-app-root-path

Determine the root path to your project
MIT License
605 stars 29 forks source link

Add support for relative imports #11

Closed funnylookinhat closed 8 years ago

funnylookinhat commented 8 years ago

I often structure applications with a source/ and dist/ directory - being able to have code within each actually target the appropriate directory based on an environment variable is extremely useful. However, it doesn't make sense for all resolves to go to those directories, as you wouldn't build configuration files from source/ to dist/ (they would likely be in config/ or something similar instead).

This enables you to set APP_RELATIVE_PATH, which will be appended to whatever would have otherwise been resolved, and then use it with resolveRelative and requireRelative.

If you would like to include this please let me know and I will add the appropriate unit tests and make any necessary stylistic changes.

inxilpro commented 8 years ago

I think this is a little too far outside of the scope of the project. Maybe you could release another module that uses app-root-path as a dependency and adds this functionality…?

funnylookinhat commented 8 years ago

@inxilpro Sounds good! That's why I asked before flushing out tests and style too much. Thanks again for the module - it's a great tool!