react-country-flag icon indicating copy to clipboard operation
react-country-flag copied to clipboard

Having issue during ssr?

Open aleyrizvi opened this issue 1 year ago • 1 comments

import ReactCountryFlag from "react-country-flag";

export default function PortalNew() {
  return (
    <div>
      <ReactCountryFlag countryCode="us" svg />
    </div>
  );
}

This is giving error at remix or nextjs app: image

Any idea?

aleyrizvi avatar Oct 28 '24 16:10 aleyrizvi

If you still haven't solved it, try setting @svgr/loader in next.config.mjs

const nextConfig = {
  webpack(config) {
    config.module.rules.push({
      test: /\.svg$/i,
      use: [
        {
          loader: '@svgr/webpack',
          options: {
            svgo: false,
          },
        },
      ],
    });
    return config;
  },
  ...
}

SWARVY avatar Dec 30 '24 00:12 SWARVY