-
-
Notifications
You must be signed in to change notification settings - Fork 124
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
Add module.parent fallback #18
Conversation
|
@SamVerschueren That wouldn't catch if |
This would look at lot nicer once https://docs.google.com/presentation/d/11O_wIBBbZgE1bMVRJI8kGnmC6dWCBOwutbN9SWOK0fU/view#slide=id.p module.parent?.filename || '.' |
index.js
Outdated
@@ -10,7 +10,7 @@ const obj = () => Object.create(null); | |||
|
|||
// Prevent caching of this module so module.parent is always accurate | |||
delete require.cache[__filename]; | |||
const parentDir = path.dirname(module.parent.filename || '.'); | |||
const parentDir = path.dirname(module.parent && module.parent.filename || '.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(module.parent && module.parent.filename) || '.'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 that's way better! Thanks forgot the ( )
@SamVerschueren Fixed this PR |
🎉 |
Getting an linting error.
@sindresorhus Might need some help :)
Fixes #17