ben-rogerson / twin.macro

🦹‍♂️ Twin blends the magic of Tailwind with the flexibility of css-in-js (emotion, styled-components, solid-styled-components, stitches and goober) at build time.
MIT License
7.92k stars 183 forks source link

Build error `pieces.some` is not a function for version `3.0.1` #761

Closed Sowed closed 1 year ago

Sowed commented 1 year ago

Hi all.

  1. I get this error after my twin.macro was upgraded to version "3.0.1". This behavior was not present in version "3.0.0" after a deleted yarn.lock. Now I keep getting this error... with next dev server.
    
    TypeError: twin.macro: pieces.some is not a function Learn more: https://www.npmjs.com/package/twin.macro
    at Array.map (<anonymous>)
    at Array.forEach (<anonymous>)
    wait  - compiling...
2. I am using styled-components with `twin.macro` with `styled-components` in a nextjs project (13 but with the pages dir).
3.  This is the code throwing the error, that was perfectly working with `v3.0.01`.

```ts
import tw from 'twin.macro';

export const CardWrapper = tw.div`
  w-full
  bg-white
  text-sm
  font-normal
  text-gray-800
`;
  1. For now, just reverted and pinned twin.macro to version:3.0.0.

  2. Thank you for this package. It's awesome. ⭐️⚽️

ben-rogerson commented 1 year ago

Hey there

I've tested those classes in the next + styled-components example with everything updated and couldn't see this issue.

I have a feeling you may have hit an error due to running an older version of tailwindcss - twin requirement.

Could you try this again, this time updating to tailwindcss@>=3.2.0 with twin.macro@latest?