diff --git a/examples/basic/client.tsx b/examples/basic/client.tsx index a682b603..8918fe24 100644 --- a/examples/basic/client.tsx +++ b/examples/basic/client.tsx @@ -1,4 +1,4 @@ import hydrate from "ultra/hydrate.js"; -import App from "./src/app.tsx"; +import App from "@/app.tsx"; hydrate(document, ); diff --git a/examples/basic/deno.json b/examples/basic/deno.json index 8080d9f1..7e153f62 100644 --- a/examples/basic/deno.json +++ b/examples/basic/deno.json @@ -1,6 +1,6 @@ { "tasks": { - "dev": "deno run -A --no-check --watch ./server.tsx", + "dev": "ULTRA_MODE=development deno run -A --no-check --watch ./server.tsx", "test": "deno test --allow-all", "build": "deno run -A ./build.ts", "start": "ULTRA_MODE=production deno run -A --no-remote ./server.js" diff --git a/examples/basic/importMap.json b/examples/basic/importMap.json index 8e37d5da..11f56a23 100644 --- a/examples/basic/importMap.json +++ b/examples/basic/importMap.json @@ -6,6 +6,7 @@ "react-dom/server": "https://esm.sh/v122/react-dom@18.2.0/server?dev", "react-dom/client": "https://esm.sh/v122/react-dom@18.2.0/client?dev", "ultra/": "https://deno.land/x/ultra@v2.2.4/", - "@ultra/qrcode/": "https://deno.land/x/qrcode@v2.0.0/" + "@ultra/qrcode/": "https://deno.land/x/qrcode@v2.0.0/", + "@/": "./src/" } } diff --git a/examples/basic/server.tsx b/examples/basic/server.tsx index ee138397..e190749a 100644 --- a/examples/basic/server.tsx +++ b/examples/basic/server.tsx @@ -1,11 +1,9 @@ import { serve } from "https://deno.land/std@0.176.0/http/server.ts"; import { createServer } from "ultra/server.ts"; -import App from "./src/app.tsx"; +import App from "@/app.tsx"; const server = await createServer({ - importMapPath: Deno.env.get("ULTRA_MODE") === "development" - ? import.meta.resolve("./importMap.dev.json") - : import.meta.resolve("./importMap.json"), + importMapPath: import.meta.resolve("./importMap.json"), browserEntrypoint: import.meta.resolve("./client.tsx"), }); diff --git a/examples/basic/src/app.tsx b/examples/basic/src/app.tsx index 39333fdb..9b7ade63 100644 --- a/examples/basic/src/app.tsx +++ b/examples/basic/src/app.tsx @@ -1,5 +1,6 @@ import useAsset from "ultra/hooks/use-asset.js"; import useEnv from "ultra/hooks/use-env.js"; +import Button from "@/components/Button.tsx"; export default function App() { // Read our environment variable from '.env' or the host environment @@ -37,6 +38,7 @@ export default function App() { customise your routing, data fetching, and styling with popular libraries.

+ diff --git a/examples/basic/src/components/Button.tsx b/examples/basic/src/components/Button.tsx new file mode 100644 index 00000000..52f77275 --- /dev/null +++ b/examples/basic/src/components/Button.tsx @@ -0,0 +1,10 @@ +import React from "react"; + +type ButtonProps = React.DetailedHTMLProps< + React.HTMLAttributes, + HTMLButtonElement +>; + +export default function Button(props: ButtonProps) { + return