Open alii opened 2 years ago
Hi @alii! Would you be interested in contributing a fix for this? You should be able to add a test case for this in here: https://github.com/blitz-js/babel-plugin-superjson-next/tree/main/test
Can certainly have a go, but I've never written a babel plugin before. Learning time!
love it! feel free to shoot me a question if you're stuck :)
For a quick hack you can just manually add superjson like so (until the PR is merged):
import { getServerSideProps } from "./getServerSideProps";
import { withSuperJSONPage as _withSuperJSONPage } from "babel-plugin-superjson-next/tools";
import { withSuperJSONProps as _withSuperJSONProps } from "babel-plugin-superjson-next/tools";
const getServerSidePropsWithSuperJSONProps =
_withSuperJSONProps(getServerSideProps);
function Page() {
...
export { getServerSidePropsWithSuperJSONProps as getServerSideProps };
export default _withSuperJSONPage(Page);
When writing
getStaticProps
outside of a page file, the superjson code is never injected. For example: