Git Product home page Git Product logo

Comments (4)

ArnaudBarre avatar ArnaudBarre commented on June 12, 2024

Seems like an issue with the plugin that's doesn't work if the jsx transform is not done at the same time with Babel.
With vite-plugin-inspect:
Screenshot 2022-12-29 at 16 47 47

JSX transform is done with esbuild since 3.0.

So for me this is not an issue with the vite plugin, more a limitation of a plugin built for a Babel only world. I would advice migrating away from Babel plugins for such a small gain. This can be implemented in few lines by a React component that does the same, or simply using ternary that are much more flexible. When using Babel plugins, you're running Babel in production build too, which is slower and blocks you from using other native toolchain like SWC, bun or new one to come.

from vite-plugin-react.

FatehAK avatar FatehAK commented on June 12, 2024

Ah! So the 3.0 version of the plugin can't work with any Babel plugins that work with JSX code since esbuild handles it now.

Will Babel plugins still work for pure JS files? I just want to understand if any Babel plugins would work with new 3.0 plugin version.

Is it possible to update the docs with these details?

from vite-plugin-react.

ArnaudBarre avatar ArnaudBarre commented on June 12, 2024

Everything should as normal, it just the plugin that doesn't handle the case of "jsx output".

The plugin should output {true ? "foo" : null} in that case instead of true ? "foo" : null

Other plugins that don't depend on that or handle it should work the same.

from vite-plugin-react.

FatehAK avatar FatehAK commented on June 12, 2024

Cool thanks! You can mark this issue closed.

from vite-plugin-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.