Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommonJS Require example; path vs module #29

Open
mattdesl opened this issue Sep 17, 2015 · 1 comment
Open

CommonJS Require example; path vs module #29

mattdesl opened this issue Sep 17, 2015 · 1 comment

Comments

@mattdesl
Copy link

In Node/CommonJS when you require('lib/math') you are requiring math.js from a module named lib. This can be a point of confusion for newbies since it seems like you are requiring from a local path.

var math = require('lib/math');
console.log('2π = ' + math.sum(math.pi, math.pi));

The above might be clearer if it used either of these require paths:

require('./lib/math.js') // local path
require('lodash/array/chunk.js') // node_modules path
@mattdesl
Copy link
Author

EDIT: see updated issue ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant