-
Notifications
You must be signed in to change notification settings - Fork 825
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
NextJS build failed because of ReferenceError: CustomEvent is not defined
#1134
Comments
Hey @shricodev dynamic import importing the component when using it, fixes this issue. Have you tried that import dynamic from 'next/dynamic';
const HankoAuth = dynamic(() => import('@/components/HankoAuth'), { ssr: false })
export default function LoginPage() {
return (
<HankoAuth />
);
} You can also find it in the docs, it has been updated |
@Ashutosh-Bhadauriya I have already tried dynamically importing the
This is the code that renders import dynamic from "next/dynamic";
// This is imported dynamically to get rid of a hanko bug.
// ReferenceError: CustomEvent is not defined
const HankoAuth = dynamic(() => import("@/components/HankoAuth/HankoAuth"), {
ssr: false,
});
export default function LoginPage() {
return (
<div className="flex min-h-screen items-center justify-center">
<HankoAuth />
</div>
);
} import dynamic from "next/dynamic";
import type { ComponentType } from "react";
// These are imported dynamically to get rid of a hanko bug.
// ReferenceError: CustomEvent is not defined
const HankoProfile = dynamic(
() => import("@/components/HankoProfile/HankoProfile"),
{
ssr: false,
},
);
import LogoutButton from "@/components/HankoLogout/LogoutBotton";
type Props = {};
const Page: ComponentType<Props> = (props) => {
return (
<div className="mx-auto flex w-fit flex-col justify-center space-y-6 px-6">
<HankoProfile />
<LogoutButton />
</div>
);
};
export default Page; PS: I have also tried dynamic importing the |
Okay taking a look |
Checklist
Describe the bug
This is the complete error trace - https://gist.github.com/shricodev/6c9078d781ba5c4d62d420d16765c025
Steps already taken
After going through the issues section in this repo, I found a closed issue that addressed this error. I tried dynamic importing the modules as shown here. This did not fix it either, or perhaps I missed something.
My repo state in which the error is observed - https://github.com/shricodev/pdfwhisper-openai/tree/50705dd06f9c78327f1a5241c91845d0daad4c5f
However, I found a fix to use
in
layout.tsx
to fix the error that was not letting me build the application. But, on runningThe error is again seen in the console:
Reproducing the bug
pnpm run build
pnpm run start
Logs
No response
Configuration
No response
Hanko Version
0.8.4
OS Hanko Backend
Windows
OS Version Hanko Backend
No response
OS
None
OS Version
No response
Browser Version
No response
Environment
None
Additional Context
No response
The text was updated successfully, but these errors were encountered: