-
Notifications
You must be signed in to change notification settings - Fork 13
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
fix: Cannot find module '.\dir\foo.js' under windows #53
fix: Cannot find module '.\dir\foo.js' under windows #53
Conversation
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.
Thanks, this is a great improvement!
const globPaths = globSync(args[0].value, { cwd, dotRelative: true }).sort() | ||
const globPaths = globSync(args[0].value, { cwd, dotRelative: true }) | ||
.sort() | ||
.map((globPath) => globPath.replace(/\\/g, '/')) |
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.
thoughts (non-blocking): at what point should we extract a function for this to ensure this and the above stay in sync?
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #53 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 4 4
Lines 129 131 +2
Branches 49 49
=========================================
+ Hits 129 131 +2 ☔ View full report in Codecov by Sentry. |
🎉 This PR is included in version 1.1.3 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.1.2 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
What:
globSync()
returns a list of file paths. These are passed on torequire()
which expects them to be module paths. Under unix file and module paths are the same, under windows filepaths contain\
while module paths must have/
.Passing a file path under windows then results in a
Cannot find module '.\dir\foo.js'
error.Why:
Be compatible with windows dev environments.
How:
All
\
are replaced with/
Checklist: