Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'split' of undefined #309

Closed
michaelpumo opened this issue Mar 18, 2021 · 5 comments
Closed

TypeError: Cannot read property 'split' of undefined #309

michaelpumo opened this issue Mar 18, 2021 · 5 comments
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@michaelpumo
Copy link

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)
@michaelpumo michaelpumo added the bug Something isn't working label Mar 18, 2021
@one-liang
Copy link

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: tailwindlabs/tailwindcss-jit#76

@michaelpumo
Copy link
Author

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: tailwindlabs/tailwindcss-jit#76

Oh thanks for the heads-up.

That's lame though. I have the postcss-nested plugin enabled in nuxt.config.js so it's sad I can't use nesting.

I would have to refactor a whole load of components just to use jit.

@atomtigerzoo
Copy link

Thank you for the link to the tailwindcss issue @one-liang - makes the error more understandable for me. In my case not that big deal, because I just started a project. 🙈

@dilverdev
Copy link

waiting :)

@stale
Copy link

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.

@stale stale bot added the wontfix This will not be worked on label Jun 16, 2021
@stale stale bot closed this as completed Jun 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants