首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何组合和使用多个Next.js插件

如何组合和使用多个Next.js插件
EN

Stack Overflow用户
提问于 2020-02-11 21:46:00
回答 3查看 13.7K关注 0票数 23

我想在cssscss应用程序中使用next.js

我的项目中有next.config.js

此配置用于scss

代码语言:javascript
运行
复制
// next.config.js
const withSass = require('@zeit/next-sass');

module.exports = withSass({
    cssModules: true,
    cssLoaderOptions: {
        importLoaders: 1,
        localIdentName: "[local]___[hash:base64:5]",
    }
})

我不知道如何将const withCSS = require('@zeit/next-css');与我的当前配置相结合。

我想为scss使用自定义配置(来自我的代码片段)。

有人能帮我配置下一个cssscss模块吗?

我试过:

代码语言:javascript
运行
复制
// // next.config.js
const withSass = require('@zeit/next-sass');
const withCSS = require('@zeit/next-css');

module.exports = withCSS(withSass({
    cssModules: true,
    cssLoaderOptions: {
        importLoaders: 1,
        localIdentName: "[local]___[hash:base64:5]",
    }
}))

不工作.

EN

Stack Overflow用户

发布于 2020-02-12 14:08:52

您可以使用next-compose-plugins并按以下方式组合多个next.js插件:

代码语言:javascript
运行
复制
// next.config.js
const withPlugins = require('next-compose-plugins');
const withSass = require('@zeit/next-sass');
const withCSS = require('@zeit/next-css');

module.exports = withPlugins(
  [
    [withSass, { /* plugin config here ... */ }],
    [withCSS,  { /* plugin config here ... */ }],
  ],
  {
    /* global config here ... */
  },
);
票数 37
EN
查看全部 3 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60177847

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档