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(compiler): normalizePath result from fs.realpathSync #2625

Merged
merged 1 commit into from Aug 10, 2020

Conversation

@ajmchambers
Copy link
Contributor

@ajmchambers ajmchambers commented Aug 10, 2020

This fixes a windows specific issue when resolving modules due to path formatting (discovered investigating this).

In my case when resolving the uuid package, it was looking for:

"C:\\Development\\stencil-node-resolve-issue\\node_modules\\uuid\\dist\\esm-node\\index.js"

against:

{
  "./dist/md5.js": "C:/Development/stencil-node-resolve-issue/node_modules/uuid/dist/md5-browser.js",
  "C:/Development/stencil-node-resolve-issue/node_modules/uuid/dist/md5.js": "C:/Development/stencil-node-resolve-issue/node_modules/uuid/dist/md5-browser.js",
  "./dist/rng.js": "C:/Development/stencil-node-resolve-issue/node_modules/uuid/dist/rng-browser.js",
  "C:/Development/stencil-node-resolve-issue/node_modules/uuid/dist/rng.js": "C:/Development/stencil-node-resolve-issue/node_modules/uuid/dist/rng-browser.js",
  "./dist/sha1.js": "C:/Development/stencil-node-resolve-issue/node_modules/uuid/dist/sha1-browser.js",
  "C:/Development/stencil-node-resolve-issue/node_modules/uuid/dist/sha1.js": "C:/Development/stencil-node-resolve-issue/node_modules/uuid/dist/sha1-browser.js",
  "./dist/esm-node/index.js": "C:/Development/stencil-node-resolve-issue/node_modules/uuid/dist/esm-browser/index.js",
  "C:/Development/stencil-node-resolve-issue/node_modules/uuid/dist/esm-node/index.js": "C:/Development/stencil-node-resolve-issue/node_modules/uuid/dist/esm-browser/index.js",
}

which failed and it ended up using the esm-node version instead of the esm-browser version.

Adding normalizePath to the result of fs.realpathSync fixed the issue for me - though there may be a better place to do this.

@adamdbradley adamdbradley merged commit df83c83 into ionic-team:master Aug 10, 2020
@adamdbradley
Copy link
Member

@adamdbradley adamdbradley commented Aug 10, 2020

Good catch, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.