Skip to content

Commit

Permalink
chore: update docs for superjson configuration (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
foyarash authored Mar 11, 2024
1 parent cc0a71d commit 3daf60d
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions apps/docs/pages/docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,77 @@ npm install -S @premieroctet/next-admin prisma-json-schema-generator
pnpm install -S @premieroctet/next-admin prisma-json-schema-generator
```

## SuperJson configuration

SuperJson is required to avoid errors related to invalid serialisation properties that can occur when passing data from server to client.

### With Babel

###### yarn

```bash
yarn add -D babel-plugin-superjson-next superjson@^1
```

###### npm

```bash
npm install --save-dev babel-plugin-superjson-next superjson@^1
```

###### pnpm

```bash
pnpm install -D babel-plugin-superjson-next superjson@^1
```

Add the `babel-plugin-superjson-next` plugin to your `.babelrc` file:

```json
{
"presets": ["next/babel"],
"plugins": ["superjson-next"]
}
```

## With SWC (Experimental)

###### yarn

```bash
yarn add -E -D next-superjson-plugin@0.6.1 superjson
```

###### npm

```bash
npm install --save-dev -E next-superjson-plugin@0.6.1 superjson
```

###### pnpm

```bash
pnpm install -E -D next-superjson-plugin@0.6.1 superjson
```

Add the `next-superjson-plugin` plugin to your `next.config.js` file:

```js
module.exports = {
// your current config
experimental: {
swcPlugins: [
[
"next-superjson-plugin",
{
excluded: [],
},
],
],
},
};
```

## Quick Start

Add the `prisma-json-schema-generator` generator to your `schema.prisma` file:
Expand Down

0 comments on commit 3daf60d

Please sign in to comment.