https://github.com/pmndrs/swc-jotai
https://github.com/pmndrs/swc-jotai
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/pmndrs/swc-jotai
- Owner: pmndrs
- License: mit
- Created: 2022-08-02T07:40:59.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-28T10:15:47.000Z (7 months ago)
- Last Synced: 2025-05-08T19:24:14.634Z (about 1 month ago)
- Language: Rust
- Size: 133 KB
- Stars: 97
- Watchers: 6
- Forks: 16
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# swc-jotai
SWC plugins for [Jotai](https://github.com/pmndrs/jotai).
[Try it out using CodeSandbox](https://codesandbox.io/s/next-js-with-custom-swc-plugins-ygiuzm).
## Install
```sh
npm install --save-dev @swc-jotai/debug-label @swc-jotai/react-refresh
```The plugins can be used by themselves as well.
## Usage
You can add the plugins to `.swcrc`:
Then update your `.swcrc` file like below:
```json
{
"jsc": {
"experimental": {
"plugins": [
["@swc-jotai/debug-label", {}],
["@swc-jotai/react-refresh", {}]
]
}
}
}
```You can use the plugins with [experimental SWC plugins feature](https://nextjs.org/docs/advanced-features/compiler#swc-plugins-experimental) in Next.js.
```js
module.exports = {
experimental: {
swcPlugins: [
["@swc-jotai/debug-label", {}],
["@swc-jotai/react-refresh", {}],
],
},
};
```### Custom atom names
You can enable the plugins for your custom atoms. You can supply them to the plugins like below:
```js
module.exports = {
experimental: {
swcPlugins: [
["@swc-jotai/debug-label", { atomNames: ["customAtom"] }],
["@swc-jotai/react-refresh", { atomNames: ["customAtom"] }],
],
},
};
```