使用 next-compose-plugins 實現多插件配置

本文首發:shudong.wang/10606.htmlcss

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

複製代碼
相關文章
相關標籤/搜索