🚀 Socket Launch Week 🚀 Day 2: Introducing Repository Labels and Security Policies.Learn More
Socket
Sign inDemoInstall
Socket

next-superjson

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-superjson

Automatically transform your Next.js Pages to use SuperJSON, without losing swc support

1.0.7
latest
Source
npm
Version published
Weekly downloads
7.3K
11.12%
Maintainers
1
Weekly downloads
 
Created
Source

Getting started

Install the library with your package manager of choice, e.g.:

npm install next-superjson

Since this is a companion to SuperJSON, make sure it's also installed:

npm install superjson

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

const { withSuperjson } = require('next-superjson')

module.exports = withSuperjson()({})

That's it! Now you're free to use all values and type supported by SuperJSON in your Next.js Components.

How it works

New Nextjs 12 uses swc to compile user code by default, adding a custom .babelrc file will make Nextjs compile everything using Babel instead (much slower).

This plugin will inject the superjson babel plugin only on files under the pages directory so you can keep using swc for all the other files.

Sponsors

Notaku

Notaku

Keywords

superjson

FAQs

Package last updated on 12 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts