tabler / tabler-icons

A set of over 5400 free MIT-licensed high-quality SVG icons for you to use in your web projects.
https://tabler.io/icons
MIT License
17.84k stars 886 forks source link

React - Module not found: Package path . is not exported from package #975

Closed evokelektrique closed 4 weeks ago

evokelektrique commented 7 months ago

I can't use this library with react in my nextjs application, i get the following error:

Code:

import { IconAward } from "@tabler/icons";
...
 <IconAward
    size={36} // set custom `width` and `height`
    color="red" // set `stroke` color
    stroke={3}  // set `stroke-width`
    strokeLinejoin="miter" // override other SVG props
  />

Error:

Module not found: Package path . is not exported from package <PATH_TO_MY_APPLICATION>/node_modules/@tabler/icons (see exports field in <PATH_TO_MY_APPLICATION>/node_modules/@tabler/icons/package.json)

Package Version: "@tabler/icons": "^2.46.0",

is there a solution for this ?

ZombieChowder11 commented 6 months ago

I've had the same issue and what I found is that I was using the wrong package. If you are using React (or NextJS, since it's again React), you ought to be using the dedicated React package for the tabler icons. Here's a link for it: https://www.npmjs.com/package/@tabler/icons-react

Switching to this package solved the Module not found bug for me. Good luck