Coder Social home page Coder Social logo

Comments (5)

thekip avatar thekip commented on June 14, 2024

It's not a limitation of macro nor swc plugin. It is how your build pipeline process js/mjs files. It seems your configuration just skip applying SWC to them. Start from there.

from swc-plugin.

chrischen avatar chrischen commented on June 14, 2024

I forked the lingui repo and modified the react-swc example:
chrischen/js-lingui@88e8e19

If I simply swap out @vitejs/plugin-react-swc with @vitejs/plugin-react (which uses Babel) then the lingui JS macro works with used from a vanilla .js file.

Are you saying the issue is probably in @vitejs/plugin-react-swc since with Vite I don't really configure the build pipeline apart from the plugin? If so I will open this issue in the vitejs repo.

from swc-plugin.

thekip avatar thekip commented on June 14, 2024

Are you saying the issue is probably in @vitejs/plugin-react-swc since with Vite I don't really configure the build pipeline apart from the plugin?

Yes, it is. They might skip js/mjs files because they don't need transpilation by theirs opinion.

FYI: https://github.com/vitejs/vite-plugin-react-swc/blob/main/src/index.ts#L206-L217

from swc-plugin.

chrischen avatar chrischen commented on June 14, 2024

Ok I will cose and re-open the issue with them and see if they are open to changing it. My understanding is that SWC can be used for Macros, and macros can be used with vanilla JS files.

from swc-plugin.

thekip avatar thekip commented on June 14, 2024

tracking issue vitejs/vite-plugin-react-swc#182

from swc-plugin.

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.