Skip to content

Commit

Permalink
Fix #5
Browse files Browse the repository at this point in the history
  • Loading branch information
N2D4 committed Apr 8, 2024
1 parent 7dbf14f commit f80d9fa
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/web-demo/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions examples/web-demo/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import { PolyfillsOnClient } from "./polyfills-on-client";

const inter = Inter({ subsets: ["latin"] });

Expand All @@ -14,6 +15,7 @@ export default function RootLayout({
}>) {
return (
<html lang="en">
<PolyfillsOnClient />
<body className={inter.className}>{children}</body>
</html>
);
Expand Down
8 changes: 8 additions & 0 deletions examples/web-demo/src/app/polyfills-on-client.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"use client";

import { applyPolyfills } from "@/polyfills";
applyPolyfills();

export function PolyfillsOnClient() {
return <></>;
}
12 changes: 12 additions & 0 deletions examples/web-demo/src/polyfills.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export function applyPolyfills() {
console.log("Applying polyfills...");

/**
* The `node-postgres` module uses `Error.captureStackTrace`, which isn't supported on all modules. This is a polyfill for that.
*
* constructorOpt is not supported by this polyfill.
*/
Error.captureStackTrace ||= (error: Error, constructorOpt?: any) => {
error.stack = new Error().stack;
};
}

0 comments on commit f80d9fa

Please sign in to comment.