Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use multiple plugins with withNextIntl()({ ...nextConfig }) ? #19

Closed
MorganSD opened this issue Sep 16, 2020 · 1 comment
Closed

Comments

@MorganSD
Copy link

MorganSD commented Sep 16, 2020

it seems withNextIntl only accepts direct configurations, not plugins!

ex: I attempt to wrap current plugins with withNextIntl but it throws errors

const withBundleAnalyzer = require('@next/bundle-analyzer')({
  enabled: process.env.ANALYZE === 'true',
});

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

const nextConfig = {
  // target: 'serverless',
  webpack(config) {
    config.module.rules.push({
      test: /\.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/,
      use: {
        loader: 'url-loader',
        options: {
          limit: 100000,
          name: '[name].[ext]',
        },
      },
    });

    return config;
  },
};

module.exports = withBundleAnalyzer(withSass(withCSS(nextConfig)));
@satazor
Copy link
Contributor

satazor commented Sep 16, 2020

@MorganSD withNextIntl is a factory, so you need to call it like so: withNextIntl()(nextConfig). This is like that so that we can add options later on if we need it, while being able to use compose or next-compose-plugins. See https://github.com/moxystudio/next-with-moxy/blob/7fbd99e92fdf5d10751da62fbd0399ec09a66b08/next.config.js#L74

@satazor satazor closed this as completed Sep 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants