
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
use-client
Advanced tools
A swc plugin that automatically converts component libraries into "React Client Component".
A swc plugin that automatically converts React component libraries into "React Client Component". For example, you can automatically convert components from @mui into "React Client Component" without having to wrap a component that uses "use client".
npm:
npm install -D use-client
yarn:
yarn add -D use-client
pnpm:
pnpm i -D use-client
| Property | Type | Description |
|---|---|---|
| include | (string | IncludeConfig)[] | Array of paths to be transformed |
IncludeConfig:
| Property | Type | Description |
|---|---|---|
| path | string | Path to match | |
| insert | string | Custom content to insert at the beginning of the file, default value: "use client" |
next.js configuration:
const nextConfig = {
experimental: {
swcPlugins: [
[
"use-client",
{
include: ["@mui/material", "@mui/icons-material","antd", "@ant-design/icons"],
},
],
],
},
};
swc configuration:
{
"$schema": "https://json.schemastore.org/swcrc",
"jsc": {
"experimental": {
"plugins": [
["use-client", {
"include": ["@mui/material", "@mui/icons-material","antd", "@ant-design/icons"]
}]
]
}
}
}
Custom Insert Content:
const nextConfig = {
experimental: {
swcPlugins: [
[
'use-client',
{
include: ["path/to", {
path: "path/to",
insert: "use strict"
}]
}
],
]
}
}
At present, this is an expected behavior, The Next.js team will improve it in the future。You can temporarily solve this problem by configuring modularizeImports:
const nextConfig = {
modularizeImports: {
"@mui/material": {
transform: "@mui/material/{{member}}"
},
},
experimental: {
swcPlugins: [
[
"use-client",
{
include: ["@mui/material"],
},
],
],
},
};
Note that some functions do not follow the '@ mui/material/{{member}}' rule, such as createTheme and ThemeProvider, which need to be processed separately as' import {createTheme, ThemeProvider} from '@ mui/material/styles'`
🌟🌟🌟🌟 If this plugin is helpful to you, give the author a star.🙏🙏🙏🌟🌟🌟🌟
FAQs
A swc plugin that automatically converts component libraries into "React Client Component".
The npm package use-client receives a total of 895 weekly downloads. As such, use-client popularity was classified as not popular.
We found that use-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.