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

Circular dependency b/n esm\browser\myaccount\request.js and all the files in the transactions subfolder #1471

Closed
lvid-ascent opened this issue Oct 27, 2023 · 4 comments · Fixed by #1473
Labels

Comments

@lvid-ascent
Copy link

Describe the bug

If you install okta-auth-js in a React app with Vite, the production build fails because there is a circular dependency between the esm\browser\myaccount\request.js and all the classes in the transactions subfolder.

Reproduction Steps?

  1. Create a new React app with Vite.
  2. Reference okta-auth-js (7.4.2 or 7.4.3)
  3. Set up Okta authentication in the app so that at least one component references okta-auth-js
  4. Run a production build

You receive errors like:
Circular dependency: node_modules/@okta/okta-auth-js/esm/browser/myaccount/request.js -> node_modules/@okta/okta-auth-js/esm/browser/myaccount/transactions/PhoneTransaction.js -> node_modules/@okta/okta-auth-js/
esm/browser/myaccount/request.js

SDK Versions

7.4.2 and 7.4.3

Additional Information?

The issue can be resolved by exporting the generateRequestFnFromLinks() function from a separate file that will be referenced by the classes in the transactions subfolder.

@John0545
Copy link

Hi @lvid-ascent
This is the same issue that I'm also having for last few days, it seems there is issue with the vite 4.x.x. version. When you compile same dependencies with vite 3.2.7 it works.

@jaredperreault-okta
Copy link
Contributor

jaredperreault-okta commented Oct 31, 2023

Thank you for the report. You will look into this.

While we do, you may be able to work around this issue by explicitly defining what exported bundle Vite consumes.

Our default ESM bundle contains IDX (OIE), AuthN (Classic) and the MyAccount client. Depending on your use case, you may be able to consume a specific bundle (IDX or AuthN) and avoid the circular reference in the MyAccount client

Refs:

@denysoblohin-okta
Copy link
Contributor

Internal ref: OKTA-664667

@denysoblohin-okta
Copy link
Contributor

Release 7.5.0 will contain a fix for this issue

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

Successfully merging a pull request may close this issue.

4 participants