/babel-plugin-superjson-next

Automatically transform your Next.js Pages to use SuperJSON

Primary LanguageTypeScriptMIT LicenseMIT

superjson X next.js

Automatically transform your Next.js Pages to use SuperJSON. Supports getStaticProps & getServerSideProps.

All Contributors npm CI

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, make sure it's also installed:

npm install superjson

Add the plugin to your .babelrc. If you don't have one, create it.

{
  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.

{
  presets: ['next/babel'],
  plugins: [
    ...
    ['superjson-next', { exclude: ["someProp"] }]
  ]
}

Contributing

  1. Clone the repo
  2. yarn
  3. 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):


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

πŸ›

This project follows the all-contributors specification. Contributions of any kind welcome!