espub: jsx transform doesn't work

We are building with the latest version.

The jsx syntax in the tsx file is expressed as it is without being built.

Is there no way?

// index.mjs

  const buttonContent = <span>{children || ""}</span>;

The expected expression is:

const buttonContent = React.createElement("span", null, children || "");

Both cjs and mjs are the same.

jsx syntax doesn’t compile.


// tsconfig 

{
    compilerOptions: {
        jsx: "react"  // not working 
        jsx: "react-jsx" // compile with jsx function 
    }

}

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Oh it works fine.

The compilation result is good.

  const buttonContent = /* @__PURE__ */ React.createElement("span", null, children || "");

I will publish it as rc.13 soon

Ah my fault, compiles are belong to dist I see

Yeah, it’s caused by upstream 😅

I’ve already submitted PR to fix that https://github.com/dominikg/tsconfck/pull/73

rc 12 is exist in @rc channel image

try

npm uninstall nanobundle
npm install -D nanobundle@rc

this has fixed in rc.12