vuejs / repl

Vue SFC REPL as a Vue 3 component
https://repl-vuejs.vercel.app
MIT License
930 stars 172 forks source link

feat: add support for tsx #68

Closed CaiWenlie closed 5 months ago

sxzz commented 1 year ago

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)

CaiWenlie commented 1 year ago

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

sxzz commented 1 year ago

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}/>
CaiWenlie commented 1 year ago

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 !

amnsss commented 1 year ago

hi, when to merge?

mengqiuleo commented 1 year ago

hi, when to merge?

ddztomcat commented 1 year ago

hi, when to merge?

husayt commented 1 year ago

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

yjy8749 commented 11 months ago

hi, when to merge?