repl icon indicating copy to clipboard operation
repl copied to clipboard

feat: add support for tsx

Open CaiWenlie opened this issue 2 years ago • 9 comments

CaiWenlie avatar Jan 17 '23 07:01 CaiWenlie

I think we should have #61 first, and then users can transform Vue JSX themselves. Otherwise, we have to wait until PR https://github.com/alangpierce/sucrase/issues/450 or switch to Babel (with a huge bundle size than Sucrase)

sxzz avatar Jan 17 '23 11:01 sxzz

The transform from Sucrase is the implementation of React, so it doesn't work.

@sxzz sorry i didn't consider React situation, you may remove the transform config below, it's for vue only.

jsxPragma: 'h',
jsxFragmentPragma: 'Fragment'

https://github.com/vuejs/repl/pull/68/commits/d0829caee2cfaeca3d0be1acb494300b7072b56a#diff-adb065f7ea26f7f005649ad48bcbf0534bc860c701bb4e19c3917b125f4e2f20R22

CaiWenlie avatar Jan 18 '23 03:01 CaiWenlie

No, I mean we cannot use the built-in JSX transform function from Babel. Instead, we should use the Babel plugin https://github.com/vuejs/babel-plugin-jsx if we have to support JSX.

For example: v-model is the function that only existed in Vue not React, so Babel JSX doesn't support it.

  <input v-model={foo}/>

sxzz avatar Jan 18 '23 08:01 sxzz

No, I mean we cannot use the built-in JSX transform function from Babel. Instead, we should use the Babel plugin https://github.com/vuejs/babel-plugin-jsx if we have to support JSX.

For example: v-model is the function that only existed in Vue not React, so Babel JSX doesn't support it.

  <input v-model={foo}/>

Thanks for mentioning this. just switched to Babel !

CaiWenlie avatar Jan 29 '23 09:01 CaiWenlie

hi, when to merge?

amnsss avatar Jun 15 '23 02:06 amnsss

hi, when to merge?

mengqiuleo avatar Jul 24 '23 04:07 mengqiuleo

hi, when to merge?

ddztomcat avatar Oct 07 '23 00:10 ddztomcat

@sxzz @CaiWenlie is something still stopping this from being merged?

husayt avatar Nov 07 '23 12:11 husayt

hi, when to merge?

yjy8749 avatar Dec 07 '23 07:12 yjy8749