-
Notifications
You must be signed in to change notification settings - Fork 1.2k
react-aria/i18n circular dependency #3628
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
Comments
Hey, thanks for the issue. We haven't seen this one yet. I'm looking through those packages on our end, but I'm not seeing anything indicating we have a circular dependency. Would you be willing to look in node_modules and see what the actual circle is? (what from each file is depending on the other) |
Another thing you can do is try to reproduce the error in a more minimal setting I don't know if I'd need to pull down the codesandbox locally to see the error, but the app is running, so I have fairly high hopes that this is showing a no-error case. |
Hello! We appreciate the quick reply. I looked into the file contents and I found this:
export * from './real-module.js';
export * from './useMessageFormatter.module.js'; and import { useLocale } from '../'; by changing the line to the one below, the warning disappears: import { useLocale } from './real-main.js'; |
Thanks for doing that sluething. I have a hunch that if we change import { useLocale } from '../'; to this import {useLocale} from './context'; then that may fix the issue good news though, it's just a warning and useMessageFormatter is deprecated, so you should be able to avoid any issues with it |
Created a PR with the change, I'm seeing a different structure now in our produced dist. I don't know if you'd be willing to build us locally and check if gets rid of the warning. An easy way to test us built locally is to:
|
This should be fixed by #4038 |
@snowystinger it seems like an issue exists still exists. Would be great to update this line https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/i18n/src/useMessageFormatter.ts#L15 to import from context as per your suggestion. Even though the useMessageFormatter is deprecated there is no documentation about alternative function. Plus it requires some extra work to migrate to it. |
I'm trying to export a RAC Button in my design system package and this circular dependency is breaking the consumer's build—or maybe more correctly, the consumer app build never finishes.
|
What build system are you using? I'll reopen in a little bit. |
Building with Rollup and then consuming in a Remix app. Styles are done with Vanilla Extract. Before importing a React Aria Button, builds on both sides are fine. After importing, get a circular dependency warning in Rollup and the Remix app never completes building. |
|
I don't know any Rollup builds, unfortunately. We're also busy right now with some other priorities, so if this is a priority for you, then you'll either need to submit a fix (in which case you could use patch-package or something to apply it to your build) or see if there is a way to tell rollup to ignore this. I'm a little surprised that the new RAC stuff is using the deprecated useMessageFormatter though. Will look into this a bit more when I get some time. |
@snowystinger My Rollup config seems fine. I just removed all references to |
We're also hearing from one of our teams of this circular dependency issue. The only thing we directly reference from react-aria/i18n is Working on getting more details about their build setup, it's in an NX monorepo. They're using a version of our package that uses react-aria/i18n 3.7.1 and I'm asking them to try with the latest of ours, which is on 3.8.1 |
Thanks for letting us know. While we can see the circular dependency warning, it's just a warning. From our testing, with esbuild though, which remix uses, it doesn't appear to cause an issue. We think we can get rid of the circular dependency anyways with a post build script. We'd need to make the corresponding change in each output file It'd be good to get an actual reproduction of the failure though so we can verify that it worked completely. |
I've verified that the fix works for rollup with patch-package in the example repo I shared, the warning no longer appears. If @brandonpittman or @ashleyryan could also check with patch-package, that'd be a huge help. |
Branch has been merged, it'll be in tonight's nightly release |
Seeing this pop up again, also with rollup. Same issue too, on the latest react-aria-components (v1.1.1) package. The imports I'm using are:
And the warning I get is:
Filtering the warning out using my rollup config seems to work fine for now, but thought I'd let you all know! |
Interesting, thanks for letting us know. The build hasn't changed since we introduced the fix for this. Has it been happening the whole time? or did it just start again with a particular release? |
For those still seeing an issue, this may be addressed with #6064 |
🐛 Bug Report
We use react-aria extensively in our project, and when we upgraded to react-aria 3.19.0, a new warning appeared regarding the circular dependency between
react-aria/i18n/dist/module.js
andreact-aria/i18n/dist/useMessageFormatter.module.js
.Upgrading to 3.20.0 didn't solve the issue.
We couldn't find any mention of this issue here, and also couldn't find the culprit on our end, so we decided to raise it.
If you think it's a problem on our end, we'd be happy to receive any pointers on what to look into.
🤔 Expected Behavior
No circular dependencies present.
😯 Current Behavior
A warning is shown about the circular dependency in
react-aria/i18n
when we're building our package:🌍 Your Environment
The text was updated successfully, but these errors were encountered: