使用 next-compose-plugins 实现多插件配置

const withPlugins = require('next-compose-plugins');

配置规则

module.exports = withPlugins(
  [
    [
      stylus,{插件一}
    ],
    [
      css,{插件二}
    ]
  ],
  nextConfig
);

案例

const nextConfig = {}
module.exports = withPlugins(
  [
    [
      stylus,
      {
        cssModules: true,
        cssLoaderOptions: {
          importLoaders: 1,
          localIdentName
        }
      }
    ],
    [
      css,
      {
        cssModules: true,
        cssLoaderOptions: {
          localIdentName
        }
      }
    ]
  ],
  nextConfig
);