lucacasonato / esbuild_deno_loader

Deno module resolution for `esbuild`
https://deno.land/x/esbuild_deno_loader
MIT License
160 stars 43 forks source link

Preact support #126

Closed mvestnik closed 4 months ago

mvestnik commented 4 months ago

Please add preact support

Test component:

import { render, Component } from "https://esm.sh/preact@10.20.2"

export class Test extends Component {
    render() {
        return (
            <>
                <button>Post</button>
            </>
        )
    }
}

render(<Test />, document.getElementById("#test"))

Esbuild config:

import * as esbuild from "https://deno.land/x/esbuild@v0.20.2/mod.js"
import { denoPlugins } from "https://deno.land/x/esbuild_deno_loader@0.9.0/mod.ts"

const context = await esbuild.context({
    plugins: [...denoPlugins()],
    entryPoints: ["frontend/app/*.tsx"],
    jsx: "automatic",
    jsxImportSource: "preact",
    bundle: true,
    minify: true,
    format: "esm",
    outdir: "static/js",
})

await context.watch()

Result: Screenshot from 2024-04-19 10-29-30.png