Skip to content

Latest Tailwind and @tailwindcss/jit compilation - TypeError: Cannot read property 'theme' of undefined #5110

Discussion options

You must be logged in to vote

Nevermind. I was using the old @tailwindcss/jit instead of just setting mode: 'jit' in tailwind.config.js. This seems to fix it.

If anyone needs to use @tailwindcss/jit for any reason, you can also fix it by updating this bit of @tailwindcss\jit\src\index.js:

// around line 45
return postcss([
  removeLayerAtRules(context),
  expandTailwindAtRules(context, registerDependency),
  expandApplyAtRules(context),

  // begin changes
  evaluateTailwindFunctions(context), // instead of evaluateTailwindFunctions(context.tailwindConfig),
  substituteScreenAtRules(context), // instead of substituteScreenAtRules(context.tailwindConfig),
  // end changes.

  collapseAdjacentRules(context),
]).process(r…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jelleroorda
Comment options

Answer selected by simonswiss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #5109 on July 29, 2021 05:33.