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

[Packager] Generate module name seperated by '/' on Windows. #2813

Closed
wants to merge 5 commits into from

Conversation

tdzl2003
Copy link
Contributor

I think packager on different platform should generate same output if possible. So packager should replace '' in module name with '/' on Windows.

@tdzl2003 tdzl2003 changed the title bugfix: Module name is not seperated by '/' but '\\' on Windows. [Packager] Generate module name seperated by '/' on Windows. Sep 17, 2015
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 17, 2015
@mkonicek
Copy link
Contributor

@martinbigio What do you think?

By using module path as module id cause issues when resolving module dependence,change Win path like'\\' or '\' to '/' before generate bundle code.
@martinbigio
Copy link
Contributor

should you also update the the on the constructor? this.path = path.resolve(file);

Take a look also on #2829. I don't have a windows computer to make sure either this or that is sufficient to fix the path issue

@tdzl2003
Copy link
Contributor Author

#2829 still causing errors on my machine. It changed module define and dependencies, but not changing path in require statement。

I don't think change "path" property is necessary. That may effect to many places. File path on windows can still performed with '', only the module name used in __d and require should replace '' to '/'

@martinbigio
Copy link
Contributor

The change looks fine to me. I wonder if the mentioned PR (which we've already landed) wouldn't be necessary with this. Could you if we could keep the internals as they used to be (reverting that diff)?

@tdzl2003
Copy link
Contributor Author

No it's not necessary.

#2829 still causing errors on my machine. It changed module define and dependencies, but not changing path in require statement。

@martinbigio
Copy link
Contributor

do you mind including the revert of that on this PR?

@tdzl2003
Copy link
Contributor Author

#2829 merged and reverted.

@@ -56,7 +56,7 @@ class Module {
return this.path;
}

return path.join(name, path.relative(p.root, this.path));
return path.join(name, path.relative(p.root, this.path)).replace(/\\/g, '/');
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any way path.join can return null or undefined?

Copy link
Contributor

Choose a reason for hiding this comment

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

not if the parameters are defined

@mkonicek
Copy link
Contributor

Cool! Is this good to go now?

@martinbigio
Copy link
Contributor

@facebook-github-bot shipit

@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/413996215466890/int_phab to review.

@ghost ghost closed this in 450cd5c Sep 18, 2015
MattFoley pushed a commit to skillz/react-native that referenced this pull request Nov 9, 2015
Summary: I think packager on different platform should generate same output if possible. So packager should replace '\\' in module name with '/' on Windows.

Closes facebook#2813

Reviewed By: @​svcscm

Differential Revision: D2458634

Pulled By: @martinbigio
cpojer pushed a commit to facebook/metro that referenced this pull request Jan 26, 2017
Summary: I think packager on different platform should generate same output if possible. So packager should replace '\\' in module name with '/' on Windows.

Closes facebook/react-native#2813

Reviewed By: @​svcscm

Differential Revision: D2458634

Pulled By: @martinbigio
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants