Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update docs for superjson configuration #166

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 [email protected] superjson
```

###### npm

```bash
npm install --save-dev -E [email protected] superjson
```

###### pnpm

```bash
pnpm install -E -D [email protected] 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
Loading