What if switching frameworks didnβt mean rewriting everything from scratch?
Frontend developers are constantly facing this problem:
- You start with React, then your team (or client) prefers Vue
- You want to reuse logic across ecosystems
- Or you're exploring frameworks but hate duplicating effort
So I built something to challenge that.
π₯ Introducing: cross-framework
A source-to-source compiler that converts:
π React (JSX / TSX) β Vue 3 (Single File Components)
And no β this is not regex hacks or AI guessing.
This is a real compiler pipeline:
- Parse code using Babel
- Transform into an intermediate representation (IR)
- Emit clean Vue 3
<script setup>+<template>
π₯ Demo (see it in action)
Watch the demo here:
https://x.com/i/status/2037575942160122244
π§ Why this matters
Switching frameworks today is expensive:
- Rewriting components manually
- Risk of introducing bugs
- Losing consistency across codebases
AI tools try to solve this, but:
- β Results are inconsistent
- β Require prompt engineering
- β Break structure in complex cases
- β Come with ongoing pricing plans
This project focuses on:
β deterministic output
β structured transformations
β developer-first control
βοΈ How it works
CLI usage
npm install cross-framework
npx cross-framework convert --from react --to vue ./path/Component.tsx
This generates:
Component.vue
You can also specify an output directory with --out-dir.
Programmatic API
import { convertCode } from "cross-framework"
const vueCode = convertCode({
from: "react",
to: "vue",
sourceCode: reactSource,
filename: "Component.tsx",
})
π§© What it supports
β React Features
- Function components (default / named exports)
-
memoandforwardRef
β Hooks β Vue equivalents
-
useStateβref -
useRefβref -
useMemoβcomputed -
useEffectβwatch,watchEffect,onMounted
β JSX β Vue Template
- Props & spreads
- Events
- Lists (
map) - Conditionals
- Fragments
All transformed into clean Vue 3 template syntax:
-
classNameβclass/:class - JSX β template IR β Vue output
β οΈ Current limitations
Like any early-stage compiler, there are some constraints:
- Imports are not rewritten
- Multi-component files may need manual adjustments
- Design-system-heavy props might need cleanup
π Try it yourself
π§ͺ Playground:
https://cross-framework.netlify.app/
π Documentation:
https://cross-framework-doc.netlify.app/
π§ The vision
This is just the beginning.
Next steps:
- Support more frameworks (Angular, Svelte, etc.)
- Convert entire projects, not just components
- Build a universal transformation pipeline for frontend code
Imagine:
Write once β run anywhere (React, Vue, moreβ¦)
β€οΈ Support the project
If you believe in this direction and want to see it grow:
π https://github.com/sponsors/parsajiravand
π€ Join the team
Iβm looking for developers who want to build something ambitious in the frontend ecosystem.
If you're interested in contributing long-term:
π§ Final thought
Weβve spent years choosing frameworks.
Maybe itβs time to stop choosingβ¦
and start abstracting the boundaries between them.
#webdevelopment #frontend #reactjs #vuejs #javascript #typescript #opensource #programming #softwareengineering #developer #coding #devtools #saas #ai #buildinpublic #100daysofcode #github #webdev #frontenddeveloper #techinnovation
Top comments (1)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.