https://github.com/blitz-js/babel-plugin-superjson-next
Automatically transform your Next.js Pages to use SuperJSON
https://github.com/blitz-js/babel-plugin-superjson-next
blitz-js json next-js react superjson
Last synced: about 1 year ago
JSON representation
Automatically transform your Next.js Pages to use SuperJSON
- Host: GitHub
- URL: https://github.com/blitz-js/babel-plugin-superjson-next
- Owner: blitz-js
- License: mit
- Created: 2020-08-04T15:14:57.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2024-12-17T18:02:39.000Z (over 1 year ago)
- Last Synced: 2025-04-01T11:04:20.761Z (about 1 year ago)
- Topics: blitz-js, json, next-js, react, superjson
- Language: TypeScript
- Homepage:
- Size: 1.93 MB
- Stars: 123
- Watchers: 3
- Forks: 15
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
X
Automatically transform your Next.js Pages to use SuperJSON.
Supports getStaticProps & getServerSideProps.
## Getting started
Install the library with your package manager of choice, e.g.:
```
npm install babel-plugin-superjson-next
```
Since this is a companion to [SuperJSON](https://github.com/blitz-js/superjson),
make sure it's also installed:
```
npm install superjson
```
> for npm 7 or later, you can skip this since from npm v7 automatically installs peer dependencies
Add the plugin to your `.babelrc`.
If you don't have one, create it.
```json5
{
presets: ['next/babel'],
plugins: [
...
'superjson-next' // π
]
}
```
That's it! Now you're free to use all values and type supported by SuperJSON in your Next.js Components.
### Options
You can use the `exclude` option to exclude specific properties from serialisation.
```json5
{
presets: ['next/babel'],
plugins: [
...
['superjson-next', { exclude: ["someProp"] }]
]
}
```
## Contributing
1. Clone the repo
1. `yarn`
1. `yarn build`
### Test Example App
1. `cd example`
2. `yarn` (make sure you first run `yarn build` in the repo root)
3. `yarn test`
## Contributors β¨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

Simon Knott
π» πΉ π€ π§

Brandon Bayer
π€ π’

Nicolas Torres
π» β οΈ π

Benjamin Johnson
π» β οΈ π

Joris
π»

Alex Rohleder
π

Alex Johansson
π¬

Cyrus
π

Gabe O'Leary
π

jlmodell
π

Cheese
π

JuanM04
π

Pieter Venter
π

Santeri Elo
π»

Diego Albitres
π»

MichaΕ Miszczyszyn
π π

Γtalo Andrade
π π»

Vincas Stonys
π

Felipe Lima
π» π

Dante
π

Nils Haberkamp
π» π π

florian-milky
π
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!