Skip to main content

One post tagged with "Okta"

View All Tags

Vite with React Okta App

· One min read

If you want to use Vite to build the React Okta App, you maybe face some incompatible issues. I will share some of my research in this post.

Vite with React Okta App

Issue 1: Uncaught TypeError: Class extends value undefined is not a constructor or null

As the Okta's staff said, It's a known issue with the ESM bundle of okta-auth-js.

So, we should add the below into the vite.config.ts

resolve: {
alias: [
{
find: '@okta/okta-auth-js',
replacement: require.resolve(
'@okta/okta-auth-js/dist/okta-auth-js.umd.js'
),
},
],
},

Issue2: Security.tsx:99 Uncaught ReferenceError: process is not defined

Solution: Add the below code to the vite.config.ts

define: {
'process.env': process.env
}

You can find the final version code on okta-demo.

References