Describe the bug
After upgrading to v0.2.1, I got the following error message when trying to build some of the components I'm developing:
error TS2742: The inferred type of 'buttonStyles' cannot be named without a reference to '.pnpm/tailwind-merge@2.2.2/node_modules/tailwind-merge'. This is likely not portable. A type annotation is necessary.
error TS2742: The inferred type of 'buttonStyles' cannot be named without a reference to '@/components/button/node_modules/tailwind-variants/dist/config'. This is likely not portable. A type annotation is necessary.
error TS2742: The inferred type of 'buttonStyles' cannot be named without a reference to '@/components/button/node_modules/tailwind-variants/dist'. This is likely not portable. A type annotation is necessary.
These three messages repeats several times when I run the build command.
To Reproduce
Here it is my scenario:
// From packages/components/button.styles.tsx
import { tv } from "tailwind-variants";
export const buttonStyles = tv({ slots: { base: "..." }, ... });
// From packages/components/pagination.tsx
import { buttonStyles } from "@/components/button/button.styles";
const { base } = buttonStyles({ ... });
Above, I'm importing the Button styles to reuse on the Pagination component. That's what started it all. After that, I got some inconsistent build behavior even from the simple usage of tv inside a single package. The error occurs when tsup is building DTS files.
I'm working on a monorepo, using PNPM as package manager and tsup to build the package. I've tried to clean up PNPM's cache and tweak some tsconfig configs, with no success. The only stable solution I got was to rollback Tailwind Variants to v0.1.2.
Describe the bug After upgrading to v0.2.1, I got the following error message when trying to build some of the components I'm developing:
These three messages repeats several times when I run the build command.
To Reproduce Here it is my scenario:
Above, I'm importing the Button styles to reuse on the Pagination component. That's what started it all. After that, I got some inconsistent build behavior even from the simple usage of
tv
inside a single package. The error occurs when tsup is building DTS files.I'm working on a monorepo, using PNPM as package manager and tsup to build the package. I've tried to clean up PNPM's cache and tweak some tsconfig configs, with no success. The only stable solution I got was to rollback Tailwind Variants to
v0.1.2
.This is likely related to the move to Tailwind Merge 2.2.0 on version
^0.2
. But I'm not certain exactly why.Expected behavior Expected it to just work, like it did on version
^0.1
so I can keep my project up-to-date with its dependencies.