diff options
Diffstat (limited to 'demos/hello-next/bun-framework-next')
3 files changed, 30 insertions, 3 deletions
diff --git a/demos/hello-next/bun-framework-next/client.development.tsx b/demos/hello-next/bun-framework-next/client.development.tsx index d046751b2..c4346913d 100644 --- a/demos/hello-next/bun-framework-next/client.development.tsx +++ b/demos/hello-next/bun-framework-next/client.development.tsx @@ -1,3 +1,13 @@ +var onlyChildPolyfill = React.Children.only; +React.Children.only = function (children) { + if (children && typeof children === "object" && children.length == 1) { + return onlyChildPolyfill(children[0]); + } + + return onlyChildPolyfill(children); +}; + +globalThis.global = globalThis; import * as ReactDOM from "react-dom"; import App from "next/app"; import mitt, { MittEmitter } from "next/dist/shared/lib/mitt"; @@ -21,7 +31,7 @@ import { NEXT_DATA, ST, } from "next/dist/shared/lib/utils"; -import { Portal } from "next/dist/client/portal"; +// import { Portal } from "next/dist/client/portal"; import initHeadManager from "next/dist/client/head-manager"; import PageLoader, { StyleSheetTuple } from "next/dist/client/page-loader"; import measureWebVitals from "next/dist/client/performance-relayer"; @@ -187,7 +197,7 @@ let CachedComponent: React.ComponentType; function _boot(EntryPointNamespace) { const PageComponent = EntryPointNamespace.default; - + ReactDOM.hydrate( <Container fn={(error) => <div>{JSON.stringify(error)}</div>}> <App Component={PageComponent} pageProps={data.props}></App> diff --git a/demos/hello-next/bun-framework-next/package.json b/demos/hello-next/bun-framework-next/package.json index 02377e339..7aa47a88f 100644 --- a/demos/hello-next/bun-framework-next/package.json +++ b/demos/hello-next/bun-framework-next/package.json @@ -68,5 +68,6 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", - "license": "ISC" + "license": "ISC", + "dependencies": {} } diff --git a/demos/hello-next/bun-framework-next/server.development.tsx b/demos/hello-next/bun-framework-next/server.development.tsx index 54181c271..82caf0ab7 100644 --- a/demos/hello-next/bun-framework-next/server.development.tsx +++ b/demos/hello-next/bun-framework-next/server.development.tsx @@ -1,3 +1,19 @@ +import React from "react"; +class URL { + constructor(base, source) { + this.pathname = source; + this.href = base + source; + } +} +var onlyChildPolyfill = React.Children.only; +React.Children.only = function (children) { + if (children && typeof children === "object" && children.length == 1) { + return onlyChildPolyfill(children[0]); + } + + return onlyChildPolyfill(children); +}; +globalThis.URL = URL; globalThis.global = globalThis; import { render } from "./renderDocument"; |