79642775

Date: 2025-05-28 18:08:16
Score: 1.5
Natty:
Report link

Answered

Based on this article from NEXTJS own website, I added this to next.config.ts

turbopack: {
    rules: {
      "*.svg": {
        loaders: ["@svgr/webpack"],
        as: "*.js",
      },
    },
  },

I already read this article, but I was adding the snippet as is, which is not the right way to do it.

Correct Way

import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  // INSIDE CONST, REMOVE MODULE.EXPORTS
  turbopack: {
    rules: {
      "*.svg": {
        loaders: ["@svgr/webpack"],
        as: "*.js",
      },
    },
  },
};

export default nextConfig;
Reasons:
  • Blacklisted phrase (1): this article
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: CodeWill