5 ms·
If find it's easier to distinguish modules from files by requiring modules like: require('foo'); and application files like: require('./foo.js'); //.js e
by 2mur 13y ago
If find it's easier to distinguish modules from files by requiring modules like:
require('foo');
and application files like:
require('./foo.js'); //.js extension
- qubyte 13y agoImagine if you're requiring that local module throughout your codebase. Now suppose that the module has become large enough to be come a directory. All those requires with the .js extension will break! If you leave it off, then no problem. Always avoid adding the .js.