lucacasonato / esbuild_deno_loader

Deno module resolution for `esbuild`
https://jsr.io/@luca/esbuild-deno-loader
MIT License
176 stars 46 forks source link

Preact support #126

Closed mvestnik closed 7 months ago

mvestnik commented 7 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