Next.js Discord

Discord Forum

Webpack SVGR not working in certain directories

Unanswered
Sun bear posted this in #help-forum
Open in Discord
Avatar
Sun bearOP
I've noticed that when switching to private folders (like done in the images you sent above) for better organisation, I get the following error when trying to render any icons, I'll attach the error & next config below.

2 Replies

Avatar
Sun bearOP
/** @type {import('next').NextConfig} */
const nextConfig = {
    webpack(config) {
        config.module.rules.push({
            test: /\.svg$/i,
            issuer: /\.[jt]sx?$/,
            use: ['@svgr/webpack'],
        });

        return config;
    },
};

export default nextConfig;
Image