DanielXMoore / Civet

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

bun + jsx syntax #1286

Open iacore opened 5 months ago

iacore commented 5 months 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 5 months ago

this also doesn't work as bunfig.toml

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

I found civetman + Deno working better :+1:

edemaine commented 5 months 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.