Add SWC Plugin
See original GitHub issuehttps://swc-project.github.io/docs/usage-plugin
Proposal: create an swc-plugin-macros
that is similar to babel-plugin-macros
SWC is increasing in popularity. It is aiming to be a drop-in replacement for babel with some significant speed improvements. It already has a webpack loader.
There is some early interest in how it might integrate with create-react-app (https://github.com/facebook/create-react-app/issues/8060). Looking at which babel plugins create-react-app uses it seems like most of those things are supported by swc (with only a few exceptions).
SWC appears to be missing support for:
babel-plugin-macros
(important for some of my projects)babel-plugin-transform-react-remove-prop-types
(less important in TypeScript projects)babel-plugin-transform-flow-strip-types
(generally SWC has no Flow support 🤷🏻♂️)
Generally everything else babel does for me is handled by swc preset-env (or isn’t particularly vital to my projects).
Issue Analytics
- State:
- Created 4 years ago
- Reactions:35
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Implementing a plugin - SWC
As plugin is written in the rust programming language and built as a .wasm file, you need to install rust toolchain and wasm...
Read more >how to use plugin like 'babel-plugin-import' #3042 - GitHub
The only possible solution is to chain a babel before swc, and I'm still wondering why such a legacy plugin has such a...
Read more >swc-plugin | Format.JS
swc -plugin ... Process string messages for translation from modules that use react-intl, specifically: Parse and verify that messages are ICU-compliant w/o any ......
Read more >swc-plugin-transform-import - npm
swc plugin for transforming import path to optimize bundle size. Latest version: 1.2.0, last published: 9 months ago.
Read more >gatsby-plugin-swc
It uses @parcel/css for CSS minification. How to install and use. yarn add -D gatsby-plugin-swc.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I realise this isn’t directly related, however I am working on stailwc, a swc-native version of twin.macro which serves as both
@matthewmatician I mean you could always do a two-step process. Parse with babel, transpile macros, send the program to SWC, then have SWC do the rest of the transpilation.
The only question is: how you would send the program to SWC? Obviously you could print it from babel and parse in SWC. But perhaps there’s a more efficient way? I can’t say I understand the PR you linked well enough to know quite what its API would be. If it can do a copy in a way that’s faster than a parse and print, then perhaps the perf numbers would still be favorable at the end of the day.