Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/capaj/vite-lingui-poc
just a sample app showing how to use lingui.js with vite bundler
https://github.com/capaj/vite-lingui-poc
esbuild i18n linguijs reactjs typescript vite vite-plugin vitejs
Last synced: 30 days ago
JSON representation
just a sample app showing how to use lingui.js with vite bundler
- Host: GitHub
- URL: https://github.com/capaj/vite-lingui-poc
- Owner: capaj
- Created: 2021-03-13T09:37:32.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-04-02T13:59:05.000Z (over 3 years ago)
- Last Synced: 2024-10-04T20:14:04.216Z (about 1 month ago)
- Topics: esbuild, i18n, linguijs, reactjs, typescript, vite, vite-plugin, vitejs
- Language: JavaScript
- Homepage: https://capaj.github.io/vite-lingui-poc/
- Size: 409 KB
- Stars: 9
- Watchers: 6
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Vite + Lingui.js POC
Showcase how to make lingui.js work with Vite.
For babel macros to work correctly we need babel transpilation.Solution proposed in this POC is to use a reactBabelRefreshPlugin which is mostly exact to what the official `@vitejs/plugin-react-refresh` is, but with a tweak that enables the babel transformation even in production builds.
Alternative solution would be to use https://github.com/itsMapleLeaf/vite-plugin-babel-macros together with `@vitejs/plugin-react-refresh`, but this would be slower, because the code needs to be parsed 2x by Babel instead of just once as it is implemented here in the custom plugin.To run this on your machine, just install deps and run `npm run dev`.
## Word of caution:
The custom plugin we have is incompatible with a deprecated `@babel/polyfill`. Not sure why exactly that is, but if you replace it's import with
```
import 'core-js/stable'
import 'regenerator-runtime/runtime
```
it works fine even in build time.