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(module-resolver): wrong path separator in glob call #895

Merged
merged 2 commits into from
Dec 19, 2018

Conversation

trevor-bliss
Copy link
Contributor

Details

Glob will return the matching files with forward slashes, even on windows machines.

Fixes https://github.com/salesforce/lwc-todomvc/issues/16 for Chrome. IE11 does not hit the "App is not defined" error but now gets a stackoverflow when loaded. Requires additional investigation.

Does this PR introduce a breaking change?

  • Yes
  • No

@trevor-bliss trevor-bliss requested a review from diervo December 19, 2018 01:12
@@ -34,7 +34,7 @@ function resolveModulesInDir(fullPathDir, { ignoreFolderName } = {}) {
return glob.sync(MODULE_ENTRY_PATTERN, { cwd: fullPathDir }).reduce((mappings, file) => {
const fileName = path.basename(file, MODULE_EXTENSION);
const rootDir = path.dirname(file);
const rootParts = rootDir.split(path.sep);
const rootParts = rootDir.split('/');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a mention to the glob documentation?
This is not really obvious that glob normalize the path: https://github.com/isaacs/node-glob#windows

Copy link
Contributor

@diervo diervo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

address @pmdartus comment and 🚢

Copy link
Member

@ekashida ekashida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find!

@trevor-bliss trevor-bliss merged commit 7f1f954 into master Dec 19, 2018
@trevor-bliss trevor-bliss deleted the tbliss/module-resolver-path-fix branch December 19, 2018 22:59
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

Successfully merging this pull request may close these issues.

5 participants