Help compiling preact
Here's my current setup:
I'm compiling it using esbuild as follows:
This ultimately gets compiled down to the file that I've attached. Unfortunately, when I actually try to run the code I get the error message I've attached. Any ideas?
// deno.json
{
"imports": {
"preact": "npm:preact@^10.25.4",
"@preact/signals": "npm:@preact/signals@^2.0.1"
}
}// deno.json
{
"imports": {
"preact": "npm:preact@^10.25.4",
"@preact/signals": "npm:@preact/signals@^2.0.1"
}
}// main.tsx
/** @jsx h */
import { render, h } from "preact";
import { useSignal } from "@preact/signals";
function Page() {
const count = useSignal(0);
return (
<div>
<button
class="bg-blue-500 text-white hover:bg-blue-400 rounded"
onClick={() => count.value++}
>
Click me! You've clicked me {count} times.
</button>
</div>
);
}
render(<Page />, document.getElementById('app'))// main.tsx
/** @jsx h */
import { render, h } from "preact";
import { useSignal } from "@preact/signals";
function Page() {
const count = useSignal(0);
return (
<div>
<button
class="bg-blue-500 text-white hover:bg-blue-400 rounded"
onClick={() => count.value++}
>
Click me! You've clicked me {count} times.
</button>
</div>
);
}
render(<Page />, document.getElementById('app'))I'm compiling it using esbuild as follows:
export async function buildClient(entrypoints: string[]) {
const result = await esbuild.build({
plugins: [...denoPlugins({
configPath: join(Deno.cwd(), "deno.json"),
})],
entryPoints: entrypoints,
bundle: true,
write: false,
format: "esm",
});
esbuild.stop();
return result.outputFiles;
}
buildClient(["./main.tsx"]);export async function buildClient(entrypoints: string[]) {
const result = await esbuild.build({
plugins: [...denoPlugins({
configPath: join(Deno.cwd(), "deno.json"),
})],
entryPoints: entrypoints,
bundle: true,
write: false,
format: "esm",
});
esbuild.stop();
return result.outputFiles;
}
buildClient(["./main.tsx"]);This ultimately gets compiled down to the file that I've attached. Unfortunately, when I actually try to run the code I get the error message I've attached. Any ideas?

message.txt28.57KB
