BuilderIO/mitosis

Conditional compilation

25juan opened this issue · 1 comments

25juan commented

I am interested in helping provide a feature!

Yes

Which generators are impacted?

  • All
  • Angular
  • HTML
  • Qwik
  • React
  • React-Native
  • Solid
  • Stencil
  • Svelte
  • Vue
  • Web components

What problem does this feature solve?

The ability to customize code that needs to be compiled to different frameworks when components are compiled to different frameworks。This is just compile time

What does the proposed API look like?

Write our components like this
eg:

export default function EdyButton() {

 //ifdef vue 
console.log("hello vue")
//endif

 //ifdef react
console.log("hello react")
//endif

  return <Button>Hello world!</Button>;
}

output:
React Component

export default function EdyButton() {
  console.log("hello react")
  return <Button>Hello world!</Button>;
}

Vue Component

export default function EdyButton() {
  console.log("hello vue")
  return <Button>Hello world!</Button>;
}

Additional Information

No response