DanielXMoore / Civet

A TypeScript superset that favors more types and less typing
https://civet.dev
MIT License
1.33k stars 28 forks source link

bun + jsx syntax #1286

Open iacore opened 1 week ago

iacore commented 1 week ago

I don't know how to let bun parse JSX syntax inside *.civet.

I have bunfig.toml setup as described here.

I have this file.

console.log <a>h</a>

When I try to run it with bun init.civet, it says

❯ bun init.civet
1 | console.log(<a>h</a>)
                     ^
error: Syntax Error!!
    at /home/user/meta/www.self/init.civet:1:18

Bun v1.1.15 (Linux x64)

My tsconfig.json is like this:

{
    "compilerOptions": {
        "jsx": "react-jsx",
        "jsxImportSource": "solid-js",
    }
}
iacore commented 1 week ago

this also doesn't work as bunfig.toml

jsx = "react-jsx"
jsxImportSource = "solid-js"
preload = ["@danielx/civet/bun-civet"]
iacore commented 1 week ago

I found civetman + Deno working better :+1:

edemaine commented 1 week ago

The original issue seems to be a bug in Bun: https://github.com/oven-sh/bun/issues/4519

It looks like we could work around it using an explicit Transpiler. Probably worth doing until this gets fixed in Bun.