Add the lib to your dependencies
Editing your App entrypoint
This is optional but recommended for better performances and security.
First rename your entry point file from main.tsx
(or main.ts
) to main.lazy.tsx
mv src/main.tsx src/main.lazy.tsx
The create a new main.tsx
file:
import { oidcEarlyInit } from "oidc-spa/entrypoint";
const { shouldLoadApp } = oidcEarlyInit({
freezeFetch: true,
freezeXMLHttpRequest: true
});
if (shouldLoadApp) {
import("./main.lazy");
}
You can skip this for now. It will be explained in the dedicated setup guide:
First rename your entry point file from main.tsx
(or main.ts
) to main.lazy.tsx
mv src/index.tsx src/index.lazy.tsx
The create a new index.tsx
file:
import { oidcEarlyInit } from "oidc-spa/entrypoint";
const { shouldLoadApp } = oidcEarlyInit({
freezeFetch: true,
freezeXMLHttpRequest: true
});
if (shouldLoadApp) {
import("./index.lazy");
}