Skip to content

Commit f668c5c

Browse files
authored
docs: add strip non essential fields option to SWC plugin doc (#2175)
1 parent 76bcd1e commit f668c5c

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

website/docs/ref/swc-plugin.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ const nextConfig = {
8787
module.exports = nextConfig;
8888
```
8989

90-
### Additional Configuration
90+
## Additional Configuration
91+
92+
### Runtime Modules Configuration
9193

9294
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.
9395

@@ -105,11 +107,24 @@ You can configure the plugin by passing the `runtimeModules` option. This option
105107

106108
For more details, refer to the [Runtime Configuration](/ref/conf#runtimeconfigmodule) section of the documentation.
107109

108-
:::info
109-
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.
110-
:::
110+
### Strip Non-Essential Fields
111+
112+
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:
113+
114+
```json
115+
[
116+
"@lingui/swc-plugin",
117+
{
118+
"stripNonEssentialFields": false
119+
}
120+
]
121+
```
111122

112123
## Examples
113124

114125
- [React with Vite and SWC](https://github.com/lingui/js-lingui/tree/main/examples/vite-project-react-swc)
115126
- [Next.js with SWC](https://github.com/lingui/js-lingui/tree/main/examples/nextjs-swc)
127+
128+
:::info
129+
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.
130+
:::

0 commit comments

Comments
 (0)