1

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 */
})

1 Answer 1

1

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'
  }
})
Sign up to request clarification or add additional context in comments.

2 Comments

My issue was middleware related, thanks for the help this solved it!
No problem, glad to be helpful :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.