Comments (5)
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.
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.
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.
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.
tracking issue vitejs/vite-plugin-react-swc#182
from swc-plugin.
Related Issues (20)
- Jest tests fail on v0.2.1 HOT 3
- A build error with Next.js HOT 13
- Doesn't work in NextJS 13.2.4 HOT 20
- 4.0.0-next.2 Could not resolve dependency HOT 1
- Pluging won't work anymore with next 13.3.1 (tested with up to canary 17) HOT 1
- Please update the Lingui 4.0 example code HOT 2
- Issue with variable naming convention for Lingui strings HOT 13
- nextjs-swc is unusable
- SWC 4.0.1 plugin panics on latest @swc/core version 1.3.60 HOT 8
- Next 13.4.3 onwards issue with swcPlugins HOT 8
- Error on build: Filesystem cache is not enabled, cannot read plugin from phsyical path HOT 1
- Adding @lingui/swc-plugin to react while using @vitejs/plugin-react-swc crashes the application. HOT 5
- Capitalization issues HOT 2
- Nextjs 13.x not working with typewind plugin using SWC HOT 2
- defineMessage missing comments HOT 3
- Incompatible with next > 13.4.8 HOT 1
- next version 13.4.9 HOT 1
- Macro imports get stripped in rollup and never placed back HOT 2
- <Trans /> without an explicit `id` matching the translation files renders a random string on next build only HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swc-plugin.