1

I need to export more than 1 module in my next.config.js file.

Now my file is like this:

const nextTranslate = require("next-translate");
module.exports = { ...nextTranslate() };

And i need to put this too:

   const withImages = require('next-images')
   module.exports = withImages()
  • next-compose-plugins - https://github.com/cyrilwanner/next-compose-plugins – Joel Hager Jul 10 '21 at 08:40
  • Does this answer your question: [Configure multiple next plugins: withMDX, withBundleAnalyzer](https://stackoverflow.com/a/67136971/1870780)? You don't necessarily need to use `next-compose-plugins`, you can simply chain the plugins calls. – juliomalves Jul 11 '21 at 11:34

1 Answers1

-1

next-compose-plugins is a great way to keep your next.config.js file clean

https://github.com/cyrilwanner/next-compose-plugins

example:

const withPlugins = require('next-compose-plugins');
const sass = require('@zeit/next-sass');

module.exports = withPlugins([
  [sass],
]);

As it relates to you:

const nextTranslate = require("next-translate");
const withImages = require("next-images");
const withPlugins = require("next-compose-plugins");

module.exports = withPlugins([
withImages,
nextTranslate
], { other configs here that aren't plugins })

I'm not sure about the shape of nextTranslate, but that's the gist of it.

Joel Hager
  • 2,990
  • 3
  • 15
  • 44