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: update module path to fully qualified name #277

Merged
merged 1 commit into from
Jan 12, 2023

Conversation

Ziinc
Copy link
Contributor

@Ziinc Ziinc commented Jan 12, 2023

improves fix for #275

@codecov
Copy link

codecov bot commented Jan 12, 2023

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (d0d5c69) compared to base (9f68c05).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #277   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          217       217           
  Branches        53        53           
=========================================
  Hits           217       217           
Impacted Files Coverage Δ
react-deps.js 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@molefrog molefrog merged commit 65cc5ac into molefrog:main Jan 12, 2023
@HansBrende
Copy link
Contributor

HansBrende commented Jan 13, 2023

@molefrog @Ziinc this won't work on native... the reason we need to use un-fully-qualified names is so that the bundler can decide which extension to pick up, .native.js, or .js.

If we go with the explicit .js, then the bundler will ignore .native.js completely.

EDIT: Actually, don't quote me on that... My assumption was that explicitly importing x.js rather than simply x would cause x.native.js to be ignored on native, but come to think of it, I have no idea if that's actually the case! Does anyone know for sure? @molefrog @Ziinc ? Is native smart enough to replace an explicit x.js with x.native.js if the latter file is present?

@HansBrende
Copy link
Contributor

HansBrende commented Jan 14, 2023

Ok, I looked at the generated build files from react query... it looks like their generated ESM files do a:

import {useSyncExternalStore} from './useSyncExternalStore.js'

so we should be good there (I think). However, in their cjs files, they are requiring the unqualified names, e.g.

require('./useSyncExternalStore')

so native may not work for us in those cases. They accomplish this via the following hack:
https://github.com/TanStack/query/blob/86161ca6ec7b29f71576b555206aca04831499e6/rollup.config.ts#L374

Which was introduced due to this issue of not building correctly on react native:
TanStack/query#4142

@molefrog
Copy link
Owner

I've raised a PR to have an external rollup.config.mjs file to allow plugins.

@molefrog
Copy link
Owner

molefrog commented Feb 6, 2023

Fixed in f9f7ea7

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.

3 participants