A SWC Plugin For LinguiJS
Installation
Install plugin:
npm install --save-dev @lingui/swc-plugin
yarn add -D @lingui/swc-plugin
You still need to install @lingui/macro
for typings support:
npm install @lingui/macro
yarn add @lingui/macro
Usage
.swcrc
https://swc.rs/docs/configuration/swcrc
{
"$schema": "https://json.schemastore.org/swcrc",
"jsc": {
"experimental": {
"plugins": ["@lingui/swc-plugin", {
// Optional
// Unlike the JS version this option must be passed as object only.
// Docs https://lingui.dev/ref/conf#runtimeconfigmodule
// "runtimeModules": {
// "i18n": ["@lingui/core", "i18n"],
// "trans": ["@lingui/react", "Trans"]
// }
}]
}
}
}
Or Next JS Usage:
next.config.js
const nextConfig = {
reactStrictMode: true,
experimental: {
swcPlugins: [
['@lingui/swc-plugin', {
}],
],
},
};
module.exports = nextConfig;
Note
Consult with full working example for NextJS in the /examples
folder in this repo.
License
The project is licensed under the MIT license.