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: use correct file in "main" of relay-compiler #2573

Closed
wants to merge 3 commits into from

Conversation

Haroenv
Copy link

@Haroenv Haroenv commented Nov 14, 2018

I noticed this when trying out yarn PnP, which is more strict about the module resolution algorithm than node is (which is technically a bug in Yarn, cc @arcanis), but anyway: let's fix the file here!

Node will fall back to index.js, while Yarn tried to use the non-existing RelayCompilerPublic

I noticed this when trying out yarn PnP, which is more strict about the module resolution algorithm than node is (which is technically a bug in Yarn, cc @arcanis), but anyway: let's fix the file here!

Node will fall back to `index.js`, while Yarn tried to use the non-existing `RelayCompilerPublic`
@sibelius
Copy link
Contributor

@Haroenv
Copy link
Author

Haroenv commented Nov 14, 2018

@sibelius, that's likely not a problem (didn't test, I don't have it in my dependencies now), but I did see graphql-compiler also has the file without lib. Maël told me it could be related to Haste, so I'll leave it up to the contributors of this project to enlighten me :)

@sibelius
Copy link
Contributor

I think missing main could cause problems in another scenarios, like jest

@arcanis
Copy link
Contributor

arcanis commented Nov 14, 2018

No, a missing main will simply fallback to index.js, it should be fine. The problem was that this PR had a more fringe case: there is a main, but it points to a non-existing file.

@Haroenv
Copy link
Author

Haroenv commented Nov 14, 2018

looks like this breaks the tests, will wait until someone who understands haste more than me comments :)

@yuzhi
Copy link
Contributor

yuzhi commented Dec 14, 2018

@alunyov can you take a look at this one and figure out the next steps?

@@ -10,7 +10,7 @@
"homepage": "https://facebook.github.io/relay/",
"bugs": "https://github.com/facebook/relay/issues",
"repository": "facebook/relay",
"main": "RelayCompilerPublic",
"main": "lib/RelayCompilerPublic",
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @Haroenv, thank you for looking into this. It looks like lib/RelayCompilerPublic does not exist. This should probably be just ./RelayCompilerPublic...

Can you squash your changes into single commit?
Thank you!

Copy link
Author

Choose a reason for hiding this comment

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

This is exactly what the PR is for. While the file /RelayCompilerPublic exists in the source, once published it doesn't, and the main file should be index.js instead of the non-existent file (then) RelayCompilerPublic. I'm not sure which tooling depends on the main field, but the other packages had the lib/xxx also listed when I checked last time. If possible, the main key can also be removed before publishing? This would also solve the issue I think.

I can squash once we decide on which way to go @alunyov

Copy link
Contributor

Choose a reason for hiding this comment

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

ahh I see what the problem is. @alunyov @kassens do we do CommonJS imports for the relay-compiler package? is it safe to just change the main entry point to point to lib/*?

@kassens
Copy link
Member

kassens commented Oct 18, 2019

We've fixed this with restructuring the gulpfile.

@kassens kassens closed this Oct 18, 2019
@Haroenv
Copy link
Author

Haroenv commented Oct 18, 2019

Thanks!

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

Successfully merging this pull request may close these issues.

8 participants