View this incredibly rich and interactive demo here - https://hardened-nextjs-repo.vercel.app/.
This repository demonstrates the integration of Endo and Knit within a Next.js application.
Below you can view contents of the project's _document.js file.
import { Html, Head, Main, NextScript } from "next/document";
import Script from "next/script";
export default function Document() {
return (
<Html>
<Head />
<body>
<Main />
<NextScript />
<Script
async
type="module"
src="https://esm.sh/@endo/init@1.0.2"
strategy="beforeInteractive"
/>
</body>
</Html>
);
}
The key component within this file is the Next.js specific <Script /> element as it is responsible for loading @endo/init
. When used outside of Next.js' _document.js
file, this component has been the source of issues when loading the page such as the one seen here (although it is not necessarily responsible for this issue).
Below is a screenshot of interaction from https://hardened-nextjs-repo.vercel.app