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

fix: Cannot find module '.\dir\foo.js' under windows #53

Merged
merged 2 commits into from
Jan 16, 2024

Conversation

DesselBane
Copy link
Contributor

What:

globSync() returns a list of file paths. These are passed on to require() 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:

  • Tests (not sure how to test that in the CI since it is OS dependent)
  • Ready to be merged
  • Added myself to contributors table

Copy link
Member

@mpeyper mpeyper left a 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!

Comment on lines -88 to +92
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, '/'))
Copy link
Member

@mpeyper mpeyper Jan 16, 2024

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?

Copy link

codecov bot commented Jan 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2b58d5e) 100.00% compared to head (0499f52) 100.00%.

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.
📢 Have feedback on the report? Share it here.

@mpeyper mpeyper merged commit edec675 into OpenSourceRaidGuild:main Jan 16, 2024
4 checks passed
Copy link

🎉 This PR is included in version 1.1.3 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version 1.1.2 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@DesselBane DesselBane deleted the fix/windows-paths branch February 25, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants