NextJs next.config.js adding multiple module.exports

Viewed 541

My next.config.js like:

module.exports = withBundleAnalyzer({
  swcMinify: true,

Just want to add this withCss(withPurgeCss())

But have no idea how can I add multiple wrappers?

1 Answers

You can install next-compose-plugins and use multiple plugins with withPlugins

const { withPlaiceholder } = require("@plaiceholder/next");
const withPlugins = require("next-compose-plugins");
const withBundleAnalyzer = require("@next/bundle-analyzer")({
  enabled: process.env.ANALYZE === "true",
});

const nextConfig = {
  ...global config
};

module.exports = withPlugins(
  [[withPlaiceholder], [withBundleAnalyzer], [..moere]],
  nextConfig
);
Related