swc-plugin-react-server

0.2.2 • Public • Published

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

Package Sidebar

Install

npm i swc-plugin-react-server

Weekly Downloads

2

Version

0.2.2

License

MIT

Unpacked Size

1.93 MB

Total Files

3

Last publish

Collaborators

  • himself_65