Skip to content

Commit

Permalink
Address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixMalfait committed Feb 5, 2025
1 parent 4bc0f58 commit 7f7aab4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions website/docs/ref/swc-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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.
:::

0 comments on commit 7f7aab4

Please sign in to comment.