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.

TypeError: Cannot read property 'split' of undefined

See original GitHub issue

Version

@nuxtjs/tailwindcss: v4.0.1
tailwindcss: v2.0.4
nuxt: v2.15.3

Steps to reproduce

Fresh install of all dependencies. Enable jit: true in nuxt.config.js and run npm run dev

My full Tailwind-specific config is as follows:

tailwindcss: {
  cssPath: '~/assets/css/app.css',
  configPath: 'tailwind.config.js',
  exposeConfig: false,
  config: {},
  jit: true,
}

What is Expected?

Should run without error once jit option is set to true. If I disable jit, it builds and runs fine.

What is actually happening?

When running npm run dev with jit set to true I get the following error:

Error in ./assets/css/app.css
Module build failed (from ./node_modules/extract-css-chunks-webpack-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
TypeError: Cannot read property 'split' of undefined
    at replaceSelector (/Users/michaelpumo/Documents/websites/work-less-ordinary/node_modules/@tailwindcss/jit/src/lib/expandApplyAtRules.js:83:12)
    at /Users/michaelpumo/Documents/websites/work-less-ordinary/node_modules/@tailwindcss/jit/src/lib/expandApplyAtRules.js:115:31
    at /Users/michaelpumo/Documents/websites/work-less-ordinary/node_modules/postcss/lib/container.js:115:18
    at /Users/michaelpumo/Documents/websites/work-less-ordinary/node_modules/postcss/lib/container.js:74:18
    at Root.each (/Users/michaelpumo/Documents/websites/work-less-ordinary/node_modules/postcss/lib/container.js:60:16)
    at Root.walk (/Users/michaelpumo/Documents/websites/work-less-ordinary/node_modules/postcss/lib/container.js:71:17)
    at Root.walkRules (/Users/michaelpumo/Documents/websites/work-less-ordinary/node_modules/postcss/lib/container.js:113:19)
    at /Users/michaelpumo/Documents/websites/work-less-ordinary/node_modules/@tailwindcss/jit/src/lib/expandApplyAtRules.js:114:18
    at LazyResult.runOnRoot (/Users/michaelpumo/Documents/websites/work-less-ordinary/node_modules/postcss/lib/lazy-result.js:303:16)
    at LazyResult.runAsync (/Users/michaelpumo/Documents/websites/work-less-ordinary/node_modules/postcss/lib/lazy-result.js:355:26)
    at LazyResult.async (/Users/michaelpumo/Documents/websites/work-less-ordinary/node_modules/postcss/lib/lazy-result.js:205:30)
    at LazyResult.then (/Users/michaelpumo/Documents/websites/work-less-ordinary/node_modules/postcss/lib/lazy-result.js:190:17)
    at /Users/michaelpumo/Documents/websites/work-less-ordinary/node_modules/webpack/lib/NormalModule.js:316:20
    at /Users/michaelpumo/Documents/websites/work-less-ordinary/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:367:11
    at /Users/michaelpumo/Documents/websites/work-less-ordinary/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:233:18
    at context.callback (/Users/michaelpumo/Documents/websites/work-less-ordinary/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at Object.loader (/Users/michaelpumo/Documents/websites/work-less-ordinary/node_modules/postcss-loader/dist/index.js:104:7)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
one-liangcommented, Mar 19, 2021

I have the same problem. It can work for me.

Before

.test {
  @apply text-sm;
  
  @screen lg {
    @apply text-xl
  }
}

After

.test {
  @apply text-sm;
} 

@screen lg {
  .test {
    @apply text-xl
  }
}

FYI: https://github.com/tailwindlabs/tailwindcss-jit/issues/76

0reactions
stale[bot]commented, Jun 16, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to prevent cannot read property split of undefined
This error is a TypeError , and it occurs when calling a method, operand, or argument on the wrong data type, or when...
Read more >
How to Prevent cannot read property split of ... - Gopi Gorantala
The "cannot read property 'split' of undefined" error occurs when trying to call split() method on a variable that stores an undefined value....
Read more >
Cannot Read Property 'split' of Undefined - freeCodeCamp
it will throw the TypeError: Cannot read property 'split' of undefined error. The split method. When split is called on a string, it...
Read more >
Uncaught TypeError: Cannot read property 'split' of undefined
Your question answers itself ;) If og_date contains the date, it's probably a string, so og_date.value is undefined.
Read more >
TypeError: Cannot read property 'split' of undefined - SitePoint
TypeError : Cannot read property 'split' of undefined ... Somebody please guide me. Zulfi. Zulf. ... If you want contractCode2 to be a...
Read more >

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