Skip to content
Advertisement

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

In my next.config.js I have the following configuration:

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;
      }
    })
  )
);

Last thing which I need to add here is next-fonts plugin.

I am not sure how to export withFounts in the right way.

I need next-fonts plugin to be able to use 'fonts' icons.

Advertisement

Answer

You can do this:

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

You can try to use next-compose

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement