-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4bc0f58
commit 7f7aab4
Showing
1 changed file
with
6 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,8 @@ or `overrides` for >[email protected] | |
|
||
## Usage | ||
|
||
### Basic Usage | ||
|
||
Add the following configuration to your [`.swcrc`](https://swc.rs/docs/configuration/swcrc) file: | ||
|
||
```json title=".swcrc" | ||
|
@@ -87,9 +89,8 @@ const nextConfig = { | |
module.exports = nextConfig; | ||
``` | ||
|
||
## Additional Configuration | ||
|
||
### Runtime Modules Configuration | ||
|
||
You can configure the plugin by passing the `runtimeModules` option. This option is an object that maps runtime module names to their corresponding module paths and export names. It is essential for macros, which rely on referencing the global `i18n` object. | ||
|
||
```json | ||
|
@@ -103,9 +104,11 @@ You can configure the plugin by passing the `runtimeModules` option. This option | |
} | ||
] | ||
``` | ||
|
||
For more details, refer to the [Runtime Configuration](/ref/conf#runtimeconfigmodule) section of the documentation. | ||
|
||
### Strip Non-Essential Fields | ||
|
||
Lingui strips non-essential fields from builds if `NODE_ENV` is set to `production`. You can override this behavior by using the `stripNonEssentialFields` option. For example, if you want to keep all fields regardless of the environment, you can set: | ||
|
||
```json | ||
|
@@ -115,16 +118,14 @@ Lingui strips non-essential fields from builds if `NODE_ENV` is set to `product | |
"stripNonEssentialFields": false | ||
} | ||
] | ||
|
||
|
||
``` | ||
|
||
## Examples | ||
|
||
- [React with Vite and SWC](https://github.com/lingui/js-lingui/tree/main/examples/vite-project-react-swc) | ||
- [Next.js with SWC](https://github.com/lingui/js-lingui/tree/main/examples/nextjs-swc) | ||
|
||
|
||
|
||
:::info | ||
If you would like to suggest a new feature or report a bug, please [open an issue](https://github.com/lingui/swc-plugin/issues) on the GitHub repository. | ||
::: |