I get "dynamic require of "tailwindcss/plugin" is not supported". Tailwind preset compilation problem

42 views Asked by At

I have a UI components library, where i created preset for tailwind and exported it from an entry file. Preset file:

import { PresetsConfig } from "tailwindcss/types/config";
import twAnimate from "tailwindcss-animate";
import twScrollbar from "tailwind-scrollbar";

const preset = {
  darkMode: ["class", '[data-mode="dark"]'],
  safelist: [...],
  plugins: [twAnimate, twScrollbar],
  theme: {...},
} satisfies PresetsConfig;

export default preset;

I bundle my library with this tsup configuration:

import { defineConfig } from "tsup";

export default defineConfig({
  clean: true,
  dts: true,
  entry: ["src/index.ts"],
  outDir: "lib",
  format: ["cjs", "esm"],
  minify: true,
  treeshake: true,
  tsconfig: "tsconfig.json",
  splitting: true,
  sourcemap: false,
});
0

There are 0 answers