This is a swc plugin for react server.
- [x] server action transform (port from next.js)
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'), {}
]
]
}
}
})
MIT