Open Malien opened 2 months ago
Yeah… If the import is not used in the file, the shaker keeps it alive because it may be used for side effects. In such a case, the whole imported file will be evaluated, which is sometimes impossible.
I will take a look. Maybe I can find some workaround for this specific lib.
Similar issue is also present with @radix-ui/react-toolbar
A simple vite project (no react, no babel presets, no nothing) (hey I even could get a minimal repro)
The magic happens here:
import "@radix-ui/react-tooltip"
is also sufficient.NOTE: If I were to do something like this:
The bug would not manifest. It's only when I import the entire module that it does. The import gets tree-shaken away.
If I were to miss the
<Tooltip />
part, the bug would be back.I've marked this as a regression, since the same exact project with
@linaria/vite
(tagged under git tag of@linaria/vite
in the original repro repo) doesn't exhibit the same issue.