brooksrelyt
brooksrelyt

Reputation: 4025

combining module.exports next js

I have a next js project where one module.exports can run but both can't run at the same time. How do I combine both module exports?

The module.exports = withSass({ is confusing me. How can this be added to the module.exports above it

// next.config.js
module.exports = {
  serverRuntimeConfig: { // Will only be available on the server side
    mySecret: 'secret'
  },
  publicRuntimeConfig: { // Will be available on both server and client
    staticFolder: '/static',
    appId: 'XXXXXXXXXX',
    apiKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
  }
}

const withSass = require('@zeit/next-sass')
module.exports = withSass({
  /* config options here */
})

Upvotes: 1

Views: 879

Answers (1)

henrikhorluck
henrikhorluck

Reputation: 26

So with next.js options, you simply move them into the nextConfig-argument you send to withSass(), like so:

const withSass = require('@zeit/next-sass')

module.exports = withSass({
    serverRuntimeConfig: {
    mySecret: 'secret'
  },
  publicRuntimeConfig: {
    staticFolder: '/static',
    appId: 'XXXXXXXXXX',
    apiKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
  }
})

Upvotes: 1

Related Questions