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

1,103 阅读1分钟

本文首发:shudong.wang/10606.html

使用 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
);