AxaFrance / oidc-client

Light, Secure, Pure Javascript OIDC (Open ID Connect) Client. We provide also a REACT wrapper (compatible NextJS, etc.).
MIT License
570 stars 152 forks source link

react-oidc compatibility with React 19 #1370

Closed awocallaghan closed 1 month ago

awocallaghan commented 1 month ago

Issue and Steps to Reproduce

If you try to use the React 19 beta version with the react-oidc package there's an error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'ReactCurrentDispatcher')

This is because react-oidc includes react-jsx-runtime in the library build.

I was able to get this working by changing the vite.config.ts build.rollupOptions.external to include "react/jsx-runtime":

rollupOptions: {
      external: [
        ...dependencies,
        'react/jsx-runtime',
      ],
      ....
}

Versions

7.22.4

Expected

React and related dependencies to be treated as external / peer dependencies

Actual

react-jsx-runtime included in build, causing errors when using React 19 beta

Additional Details

React 19 beta upgrade guide: https://react.dev/blog/2024/04/25/react-19

guillaume-chervet commented 1 month ago

Thank you very much @awocallaghan for your issue and the way to resolved it ! I wil try to do it as quickly as I can.

guillaume-chervet commented 1 month ago

hi @awocallaghan , I published 7.22.6-alpha.1437 with the change you propose.

awocallaghan commented 1 month ago

hi @awocallaghan , I published 7.22.6-alpha.1437 with the change you propose.

Amazing! Thanks for all your work maintaining this