Next.js Discord

Discord Forum

@tabler/icons-react + tree shaking (not working?)

Unanswered
Anglo-Français de Petite Véner… posted this in #help-forum
Open in Discord
Anglo-Français de Petite VénerieOP
I have a normal Nextjs 14.0.1 project that depends on @tabler/icons-react.

I import a small subset of its icons using:
import { IconQuestionMark } from '@tabler/icons-react';


There's no location in my project in which I use a wildcard import (i.e. import * as Icons from '@tabler/icons-react';)

Yet, somehow all icons are being bundled according to @next/bundle-analyzer.

What exactly is going on here? @tabler/icons-react uses esm where its dist folder contains 1 icon per file, so what I'm seeing should not occur.

I've also tried the following in my next.config.js, which does not change anything:
experimental: {
  optimizePackageImports: ['@tabler/icons-react'],
},

0 Replies