sometimes its faster to 
load. http://nodejs.org/api/modules.html#modules_all_together:

LOAD_AS_FILE(X)1. If X is a file, load X as JavaScript text.  STOP2. If X.js is 
a file, load X.js as JavaScript text.  STOP3. If X.node is a file, load X.node 
as binary addon.  STOP

without extension 1. fails. 2. hits, with extension 1. hits already

another possible issue is when you have something like that:

app/
-- util/
-- -- index.js
-- util.js

what is loaded then? util/index.js, because require('./util') will check 
for util being dir or file first and it is a dir

Am Freitag, 12. Juli 2013 07:46:09 UTC+2 schrieb ryandesign:
>
>
> On Jul 11, 2013, at 14:52, Tim Caswell wrote: 
>
> > This brings up another best practice.  You should *always* include the 
> extension when referring to a file (module), and only omit it when 
> referring to a package (looking up the file in package.json's main 
> property). 
>
> Why is this a best practice? 
>
> Where is this best practice documented? 
>
>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to