sindresorhus / import-from

Import a module like with `require()` but from a given path
MIT License
86 stars 8 forks source link

Any use case, to use this over require? #4

Closed zikaari closed 7 years ago

zikaari commented 7 years ago

Just curious, maybe I should know something that's better than what I use right now, require?

sindresorhus commented 7 years ago

From the readme:

Import a module like with require() but from a given path

Instead of importing relative to the current file, you can import relative to any file. So you can for example import a module relative to the user's current directory.

Example: https://github.com/sindresorhus/atom-esformatter/blob/b3c939215993f3c53ec66377ed6b631c025a97b2/index.js#L18