gothinkster / koa-knex-realworld-example

240 stars 79 forks source link

Use of NODE_PATH #2

Closed dbratz1177 closed 7 years ago

dbratz1177 commented 7 years ago

I was perusing the code and noticed that internal modules were referenced like how I was used to seeing npm packages referenced in required statements: require('config') As opposed to using the relative path: require('./config') I was curious, and did some digging, and learned some interesting mechanical things about cross-env, setting NODE_PATH, and Jest settings. I'm still curious about the motivations behind this design decision, and would love to hear them

dimonnwc3 commented 7 years ago

@dbratz1177 thanks You can look into this for the motivations: https://gist.github.com/branneman/8048520

In case of this application, I keep flat structure and it's not really necessary.

One more disadvantage: using NODE_PATH is not friendly for inteli path resolving on some IDE like webstorm

so I can think we can get rid of this

dbratz1177 commented 7 years ago

@dimonnwc3 No, thank you. Link was super informative. I'll be playing around with that and the app-module-path over the next few

ForsakenHarmony commented 6 years ago

kinda old ik, but I think the wrapper would be a better option for readability, because the way it is rn is really confusing tbh