tw("bg-gray-800") fails with @twind/preset-tailwind-forms@1.0.0-next.37
See original GitHub issueWhen I try using presetTailwindForms, I was getting an error in my code. I started getting an uncaught TypeError. I produced a minimal reproduction path for the issue.
import * as twind from "https://esm.sh/twind@1.0.0-next.37?target=deno&pin=v78";
import presetTailwind from "https://esm.sh/@twind/preset-tailwind@1.0.0-next.37?target=deno&pin=v78";
import presetTailwindForms from "https://esm.sh/@twind/preset-tailwind-forms@1.0.0-next.37?target=deno&pin=v78";
import presetTypography from "https://esm.sh/@twind/preset-typography@1.0.0-next.37?target=deno&pin=v78";
export const twindConfig = {
presets: [
presetTailwind(),
presetTailwindForms(),
presetTypography(),
],
};
const tw = twind.setup(twindConfig)
console.log(tw("bg-gray-800"));
If I run this with deno run example.js, I get the following error.
error: Uncaught TypeError: Cannot read properties of undefined (reading '500')
at s (https://cdn.esm.sh/v78/@twind/preset-tailwind-forms@1.0.0-next.37/deno/preset-tailwind-forms.js:2:1051)
at preflight (https://cdn.esm.sh/v78/@twind/preset-tailwind-forms@1.0.0-next.37/deno/preset-tailwind-forms.js:2:608)
at Yt.Object.defineProperties.Object.getOwnPropertyDescriptors.target (https://cdn.esm.sh/v78/twind@1.0.0-next.37/deno/twind.js:2:10767)
at file:///home/kyle/Projects/deno/udibo/example.js:14:13
I found that if I comment out the presetTailwindForms() line or add { strategy: 'class' } as the options for it, it works correctly. The expected output is bg-gray-800.
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks. I’ll look into it.
This was resolved in a newer version of esm.sh. esm.sh version 99 works.