如何以正确的方式配置 next.config.js 文件

How to configure next.config.js file on right way

在我的 next.config.js 中,我有以下配置:

const withCSS = require('@zeit/next-css');
const withSass = require('@zeit/next-sass');
const withImages = require('next-images');
const withFonts = require('next-fonts');

module.exports = withCSS(
  withSass(
    withFonts(),  // <=== this is wrong? 
    withImages({
      distDir: '../_next',
      webpack(config) {
        return config;
      }
    })
  )
);

我需要在这里添加的最后一件事是 next-fonts 插件。

我不确定如何以正确的方式导出 withFounts

我需要 next-fonts 插件才能使用 'fonts' icons

你可以这样做:

module.exports = withCSS(withFonts(withSass(
    withImages({
        distDir: '../_next',
        webpack(config) {
            return config;
        }
    })
)))

你可以尝试使用next-compose