cyrilwanner / next-compose-plugins

đź’ˇnext-compose-plugins provides a cleaner API for enabling and configuring plugins for next.js
MIT License
736 stars 12 forks source link

baseConfig is not a function #37

Closed handrei closed 4 years ago

handrei commented 4 years ago

hello, i'm trying to add another config file, but i still get that error : baseConfig is not a function my i18n.config.js

const { nextI18NextRewrites } = require('next-i18next/rewrites');
const localeSubpaths = { en: 'en' };

module.exports = {
  rewrites: async () => nextI18NextRewrites(localeSubpaths),
  publicRuntimeConfig: {
    localeSubpaths,
  },
};

my next.config.js

const { withPlugins, extend } = require('next-compose-plugins');
const withImages = require('next-images');

const baseConfig = require('./i18n.config');

const nextConfig = {
  webpack(config, options) {
    const { isServer } = options;
    config.module.rules.push({
      test: /\.(ogg|mp3|wav|mpe?g)$/i,
      exclude: config.exclude,
      use: [
        {
          loader: require.resolve('url-loader'),
          options: {
            limit: config.inlineImageLimit,
            fallback: require.resolve('file-loader'),
            publicPath: `${config.assetPrefix}/_next/static/images/`,
            outputPath: `${isServer ? '../' : ''}static/images/`,
            name: '[name]-[hash].[ext]',
            esModule: config.esModule || false,
          },
        },
      ],
    });

    return config;
  },
};

module.exports = extend(baseConfig).withPlugins([withImages], nextConfig);
handrei commented 4 years ago

i figure it out, sorry for the ticket.