<!--
- @Author: starkwang
- @Contact me: https://shudong.wang/about
- @Date: 2019-10-21 18:33:27
- @LastEditors: starkwang
- @LastEditTime: 2019-10-21 18:38:13
- @Description: 【nextjs教程】多插件配置,使用 next-compose-plugins实现 -->
使用 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
);
本文介绍如何在Next.js项目中使用next-compose-plugins进行多插件配置,通过具体案例展示了如何同时配置Stylus和CSS模块,实现样式模块化和加载器优化。
501

被折叠的 条评论
为什么被折叠?



