nextui-org/tailwind-variants

WithTV crashes when bundling with Rollup and TSDX

ferranrt opened this issue · 1 comments

Describe the bug
I'm building a large-scale project that uses TailwindCSS as styling engine. Few months ago I discovered tailwind-variants whichs works very well for me. Now that my project has scaled quite a lot, I want to create and split some libraries to provide all de "frontend clients" the methods and components to build the UI. More specifically:

  • One library that provides the Tailwind Custom theme and all the associated methods of tailwind variants, like TV, CN, and... withTV so I can use responsive variants.
  • One library with basic components (thinking in atomic design, I will store in that library the atoms.
  • Other libraries that use the theme and methods provided by the first one.

The problem is related with "withTV" functionality. That functionality uses internal methods of NODEJS like "fs" or "paths" functions that when I try to bundle the package (I'm creating my libraries with TSDX / Rollup) are not bundled or simply gives me an error like

Can't resolve 'fs'

Has someone faced with an issue like this?
Is there a better approach to achieve the "architecture" I've described to build a large component library like that?

Additional context
The main goal is to have a "single source of truth" about styling and methods and styling and then be able to create packages related and linked to that source of truth.

Thank you!