ParcelJs can not compile tsx dependency

13 views Asked by At

I'm trying to use a local dependency which is a simple .tsx Hello component. When I run parcel serve command it fails as below:

@parcel/transformer-js: Expected '>', got 'onClick'

  /...ello.tsx:6:15
    5 |   const [x1, setX1] = useState(0);
  > 6 |   return <div onClick={() => setX1(x1 + 1)}>hello!{x1}</div>;
  >   |               ^^^^^^^
    7 | };
    8 | 

I have added the dependency like this in package.json: "xbase": "file:../../xbase/web"

Looks like Parcel treats my tsx file as js but not sure why this happens and how I can avoid that.

0

There are 0 answers