fresh icon indicating copy to clipboard operation
fresh copied to clipboard

Docs: Is it main.ts or main.tsx

Open CAYdenberg opened this issue 3 months ago • 5 comments

The very first page of the docs is a little unclear about whether the main file is main.tsx or main.ts.

It's a bit a of problem because as it stands, JSX can't be used within that particular file, as in the first example, but the configuration is not looking for main.tsx and fails with an error if you (naively) change the extension.

CAYdenberg avatar Sep 22 '25 03:09 CAYdenberg

It is main.ts, main.tsx is not supported as the main entry point.

There may be some misleading examples in the documentation.

fry69 avatar Sep 22 '25 03:09 fry69

We should bring back support for main.tsx though. That was supported before moving to vite.

marvinhagemeister avatar Sep 22 '25 08:09 marvinhagemeister

As someone else said, the simplicity of

app.get(() => <h1>Hello world!</h1>)

is a major selling point.

CAYdenberg avatar Sep 22 '25 15:09 CAYdenberg

You can use main.tsx by updating vite.config.ts:

    fresh({
      serverEntry: "main.tsx",
    }),

stereosteve avatar Oct 18 '25 17:10 stereosteve

You can use main.tsx by updating vite.config.ts:

Oh, awesome.

Personally I think that the init project and the documentation should use main.tsx. I guess it's not possible to change the default at this point without breaking existing projects.

CAYdenberg avatar Oct 22 '25 19:10 CAYdenberg