vuejs / jsx-vue2

monorepo for Babel / Vue JSX related packages
https://jsx-vue2-playground.netlify.app/
1.47k stars 96 forks source link

Vue 2.7 compatibility #285

Closed JorisAerts closed 2 years ago

JorisAerts commented 2 years ago

Currently, the plugin does not work with Vue 2.7. I get an error saying: Module not found: Error: Can't resolve '@vue/composition-api' in '[filename]'

iceprosurface commented 2 years ago

related to https://github.com/vuejs/jsx-vue2/pull/284

iceprosurface commented 2 years ago

@sodatea Needs to be reviewed

sodatea commented 2 years ago

I've merged the corresponding PR but I'm still not sure about how to expose the new option in the preset 🤔 https://twitter.com/haoqunjiang/status/1544307876943933443

JorisAerts commented 2 years ago

I like your suggestion "target: 2.7", but it would imply somewhat that multiple choices are available, while 2.7 is the only version 2 ever which will support an internal composition api.

I suggested compositionAPI: "native" or compositionAPI: "module", or something like that. Or "embedded" iso "native" would also work.

Or something like: { compositionApi: true } // 2.7 and { compositionApi: { module: false } } // 2.7 { compositionApi: { module: true } } // < 2.7

sodatea commented 2 years ago

Fixed in https://github.com/vuejs/jsx-vue2/releases/tag/v1.3.0

I didn't choose the module option because it's a little bit confusing in the context of JavaScript (module often refers to the module system, i.e. CJS or ESM).

Thanks for your suggestions anyway!

yihuan commented 1 year ago

Is this fixed? I'm using v1.3.1 but I'm still facing this issue that the dependency @vue/composition-api was not found.