tailwindlabs/tailwindcss-jit

Maximum call stack size exceeded

edgarasben opened this issue · 7 comments

What version of @tailwindcss/jit are you using?

v0.1.11 → (Updated: v0.1.12)

What version of Node.js are you using?

v14.15.1

What browser are you using?

Safari

What operating system are you using?

macOS

Reproduction repository

https://github.com/edgarasben/bulletproof-ui/blob/main/src/Button.jsx

I get an error only when I switch to '@tailwindcss/jit' PostCSS plugin and I am trying to build a conditional CSS classes with React + Vite.

The error occurs when I add this to the Button.jsx file:

  const types = {
    primary: 'bg-blue-600 hover:bg-blue-700 text-white',
    secondary:
      'bg-blue-700 text-blue-600 hover:bg-blue-700 bg-opacity-20 hover:bg-opacity-30',
  }
  const whichType = types[props.buttonType]

Error log

[plugin:vite:css] Maximum call stack size exceeded
/Users/edgaras/Documents/Sites/bulletproof-ui/src/index.css
    at candidatePermutations (/Users/edgaras/Documents/Sites/bulletproof-ui/node_modules/@tailwindcss/jit/src/lib/generateRules.js:19:32)
    at candidatePermutations (/Users/edgaras/Documents/Sites/bulletproof-ui/node_modules/@tailwindcss/jit/src/lib/generateRules.js:41:10)
    at candidatePermutations.next (<anonymous>)
    at candidatePermutations (/Users/edgaras/Documents/Sites/bulletproof-ui/node_modules/@tailwindcss/jit/src/lib/generateRules.js:41:10)
    at candidatePermutations.next (<anonymous>)
    at candidatePermutations (/Users/edgaras/Documents/Sites/bulletproof-ui/node_modules/@tailwindcss/jit/src/lib/generateRules.js:41:10)
    at candidatePermutations.next (<anonymous>)
    at candidatePermutations (/Users/edgaras/Documents/Sites/bulletproof-ui/node_modules/@tailwindcss/jit/src/lib/generateRules.js:41:10)
    at candidatePermutations.next (<anonymous>)
    at candidatePermutations (/Users/edgaras/Documents/Sites/bulletproof-ui/node_modules/@tailwindcss/jit/src/lib/generateRules.js:41:10

Getting a very similar issue but seems tied to postcss-loader:

RangeError: Maximum call stack size exceeded
    at candidatePermutations (/Users/gl/Sites/africa/node_modules/@tailwindcss/jit/src/lib/generateRules.js:19:32)
    at candidatePermutations.next (<anonymous>)
    at candidatePermutations (/Users/gl/Sites/africa/node_modules/@tailwindcss/jit/src/lib/generateRules.js:41:10)
    at candidatePermutations.next (<anonymous>)
    at candidatePermutations (/Users/gl/Sites/africa/node_modules/@tailwindcss/jit/src/lib/generateRules.js:41:10)
    at candidatePermutations.next (<anonymous>)
    at candidatePermutations (/Users/gl/Sites/africa/node_modules/@tailwindcss/jit/src/lib/generateRules.js:41:10)
    at candidatePermutations.next (<anonymous>)
    at candidatePermutations (/Users/gl/Sites/africa/node_modules/@tailwindcss/jit/src/lib/generateRules.js:41:10)
    at candidatePermutations.next (<anonymous>)
    at candidatePermutations (/Users/gl/Sites/africa/node_modules/@tailwindcss/jit/src/lib/generateRules.js:41:10)
    at candidatePermutations.next (<anonymous>)
    at candidatePermutations (/Users/gl/Sites/africa/node_modules/@tailwindcss/jit/src/lib/generateRules.js:41:10)
    at candidatePermutations.next (<anonymous>)
    at candidatePermutations (/Users/gl/Sites/africa/node_modules/@tailwindcss/jit/src/lib/generateRules.js:41:10)
    at candidatePermutations.next (<anonymous>)

Fixed in v0.1.13, sorry about that!

Works great now! Thank you. 🙏

Fixed in v0.1.13, sorry about that!

I am still getting "Maximum call stack size exceeded" error in v0.1.13 (v0.1.11 works)

@prbroadfoot Can you provide a reproduction? What input is triggering the overflow?

@adamwathan

I have purge watching a directory of JS files compiled from ClojureScript. Here is one of the files that triggers it:

https://gist.github.com/prbroadfoot/e4eee9a106fa6f551e9ba2c5d1827876

@prbroadfoot I just tried running against that file locally and had no issues. Any chance you can create a GitHub repo I can clone that reproduces please? In a new issue would be ideal so I don't lose track of it 👍🏻