-
-
Notifications
You must be signed in to change notification settings - Fork 9k
Closed
Description
What problem does this feature solve?
Same as #5085 (comment)
Tis issue #5085 is closed. So i created this new issue.
The repo
I created a repo for support JSX runtime vue-jsx-runtime and examples vue-jsx-runtime-examples.
all vue-jsx-runtime unit test cases are came from vue jsx-next
Runtime size:
- minify Iife:
2.53Kb(no gzip) - ES Module: 8.79kb (no minify)
About examples( used TS):
Different with vue jsx-next
jsx-nextis a plugin forBabelonly.vue-jsx-runtimecan be used withBabel,TypeScript,swc,esbuildand more.
vue-jsx-runtime limits:
- can not merge ele/component props
v-modelsyntax is little different withjsx-next-v-model
First of all
We should forget the react xx, something like babel-plugin-transform-react-jsx. Maybe babel and other tools can be renamed to other name, like: jsx-runtime. 😆
The advantages
- "Standard" JSX supported, runtime jsx. It can be used with
Babel,TypeScript,swc,esbuildand more... - Runtime transform JSX ast to vue
render(). Simple and easy to extend and maintain - Maybe we can share transform logic with
compile-coreandcompile-domin the future
What does the proposed API look like?
Babel
// babel plugin
plugins: [
[
// add @babel/plugin-transform-react-jsx
'@babel/plugin-transform-react-jsx',
{
throwIfNamespace: false,
runtime: 'automatic',
importSource: 'vue-jsx-runtime'
}
],
],TS
{
"compilerOptions": {
"jsx": "react-jsxdev",
"jsxImportSource": "vue-jsx-runtime"
}
}
SWC
{
"jsc": {
"transform": {
"react": {
"runtime": "automatic",
"importSource": "vue-jsx-runtime"
}
}
}
}More tools supported in the future...
morlay
Metadata
Metadata
Assignees
Labels
No labels