question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tw("bg-gray-800") fails with @twind/preset-tailwind-forms@1.0.0-next.37

See original GitHub issue

When 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:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
sastancommented, May 5, 2022

Thanks. I’ll look into it.

0reactions
KyleJunecommented, Dec 24, 2022

This was resolved in a newer version of esm.sh. esm.sh version 99 works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found