在 next.config.js 中同时添加对 next-css 和 next-less 的支持

Amj*_*d K 2 javascript reactjs webpack next.js

我正在使用 nextJs 并且需要添加对 less 和 css 的支持。我想为一个项目同时使用 next-css 和 next-less。但它一次接受一个。这是我正在使用的

const withCSS = require('@zeit/next-css')
module.exports = withCSS({
  /* config options here */
})

const withLess = require('@zeit/next-less')
module.exports = withLess({
    cssModules: false,
    lessLoaderOptions: {
        javascriptEnabled: true
    }
})
Run Code Online (Sandbox Code Playgroud)

我是否正确地包括了两个装载机?我也需要 javascriptEnabled: true 。我们如何才能实现这种配置。

如果您能提供任何提示或两个提示,我将不胜感激。

小智 5

这应该有效。

const withCSS = require('@zeit/next-css')
const withLess = require('@zeit/next-less')
module.exports = withCSS(withLess())
Run Code Online (Sandbox Code Playgroud)