remorses / next-superjson

Automatically transform your Next.js Pages to use SuperJSON, without losing swc support
69 stars 2 forks source link

withSuperjson ignores next configs #3

Closed michaelpomogajko closed 2 years ago

michaelpomogajko commented 2 years ago

Running next build with the withSuperjson wrapper function fails because of ts errors, meaning it ignores the config for nextjs. When removing the wrapper function, it works as expected

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

const config = {
  reactStrictMode: true,
  swcMinify: true,
  eslint: {
    ignoreDuringBuilds: true
  },
  typescript: {
    ignoreBuildErrors: true
  }
}

module.exports = withSuperjson(config);
remorses commented 2 years ago

You have to call it like this

module.exports = withSuperjson()({})

I kept a first parameter to pass options to superjson and not pollute the config object