swc-plugin-react-server
v0.2.2
Published
This is a swc plugin for [react server](https://github.com/reactjs/rfcs/blob/main/text/0188-server-components.md).
Downloads
10
Maintainers
Readme
swc-plugin-react-server
This is a swc plugin for react server.
- [x] server action transform (port from next.js)
Usage
import { transform } from '@swc/core'
import { createRequire } from 'node:module'
const require = createRequire(import.meta.url)
const output = await transform(`
async function foo() {
"use server";
return 0;
}
export async function bar() {
"use server";
return "Hello world";
}
`, {
swcrc: false,
jsc: {
target: 'esnext',
experimental: {
plugins: [
[
require.resolve('swc-plugin-react-server'), {}
]
]
}
}
})
LICENSE
MIT