okta-react
okta-react copied to clipboard
compare-versions error when upgrading from version 4.1.0 to 6.5.0
Describe the bug?
I'm trying to update my project from version 4.1.0 of okta-react to 6.5.0 and version 4.4.0 of okta-auth-js to 6.7.0, but no matter what I do the following error appears:
ERROR in ./node_modules/@okta/okta-react/bundles/okta-react.esm.js 131:28-35 "export 'compare' was not found in 'compare-versions' @ ./src/components/Okta/OktaSecurityConsumer.tsx @ ./src/components/Okta/OktaSecurity.tsx @ ./src/components/Okta/index.ts @ ./src/routing/Router.tsx @ ./src/index.tsx @ multi ./config/polyfills.js ./node_modules/react-dev-utils/webpackHotDevClient.js ./src/index.tsx
What is expected to happen?
I expected the errors created by the update to be fixable in my own code.
What is the actual behavior?
The above error appears from within the okta-react package with no obvious cause or way to fix.
Reproduction Steps?
I'm not sure whether this can be reproduced, but all I did to get this error to appear was upgrade a project with an okta-react integration from 4.1.0 to the latest version of okta-react.
SDK Versions
@okta/okta-react: 4.1.0 -> 6.5.0 @okta/okta-auth-js: 4.4.0 -> 6.7.0
Execution Environment
NodeJS v. 14.15.1
Additional Information?
I've tried switching to Node 16 as well as trying various combinations of the two okta packages we're using, but nothing I've tried has influenced the error in any way.
How are you bundling/building your React app? react-scripts
? vite
?
I'm using webpack, previous owners of the codebase ejected from create-react-app.
If you don't care about using ES modules, you can specify the umd
bundle in your webpack config
resolve: {
alias: {
'@okta/okta-react': path.resolve(__dirname, 'node_modules/@okta/okta-react/okta-react.umd.js')
}
},
If you do want to use ES modules, you may need to adjust your webpack version and/or config to consume them correctly
I got the same suggestion from a ticket I opened with Okta Support around the same time as your first followup question. I'll keep fiddling with the webpack config; this project is super out of date package-wise and it's been quite the headache to update. Thanks for the input!