Repository: tailwindlabs/tailwindcss
File: src/lib/expandApplyAtRules.js (JavaScript)

Code before:
        `@apply is not supported within nested at-rules like @${apply.parent.name}. You can fix this by un-nesting @${apply.parent.name}.`
      )
    }

    for (let applyCandidate of applyCandidates) {
      if ([prefix(context, 'group'), prefix(context, 'peer')].includes(applyCandidate)) {
        // TODO: Link to specific documentation page with error code.
        throw apply.error(`@apply should not be used with the '${applyCandidate}' utility`)
      }

      if (!applyClassCache.has(applyCandidate)) {
        throw apply.error(
          `The \`${applyCandidate}\` class does not exist. If \`${applyCandidate}\` is a custom class, make sure it is defined within a \`@layer\` directive.`
        )
      }

      let rules = applyClassCache.get(applyCandidate)

      // Verify that we can apply the class
      for (let [, rule] of rules) {
        if (rule.type === 'atrule') {
          continue
        }

        rule.walkRules(() => {
          throw apply.error(
            [
              `The \`${applyCandidate}\` class cannot be applied because it uses nested CSS.`,
              'Please enable a CSS nesting plugin *before* Tailwind in your configuration.',
              'See how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting',
            ].join('\n')
          )
        })
      }

      candidates.push([applyCandidate, important, rules])
    }
  }

  for (let [parent, [candidates, atApplySource]] of perParentApplies) {
    let siblings = []

    for (let [applyCandidate, important, rules] of candidates) {
      let potentialApplyCandidates = [
        applyCandidate,
        ...extractBaseCandidates([applyCandidate], context.tailwindConfig.separator),
      ]

      for (let [meta, node] of rules) {
        let parentClasses = extractClasses(parent)
        let nodeClasses = extractClasses(node)

Review comment (bug):
I used an `error` instead of a `warning` like we used to do for 2 reasons:
1. All apply issues in this file use `error`.
2. If we just warn, we would still generate incorrect code.

Code after:
        `@apply is not supported within nested at-rules like @${apply.parent.name}. You can fix this by un-nesting @${apply.parent.name}.`
      )
    }

    for (let applyCandidate of applyCandidates) {
      if ([prefix(context, 'group'), prefix(context, 'peer')].includes(applyCandidate)) {
        // TODO: Link to specific documentation page with error code.
        throw apply.error(`@apply should not be used with the '${applyCandidate}' utility`)
      }

      if (!applyClassCache.has(applyCandidate)) {
        throw apply.error(
          `The \`${applyCandidate}\` class does not exist. If \`${applyCandidate}\` is a custom class, make sure it is defined within a \`@layer\` directive.`
        )
      }

      let rules = applyClassCache.get(applyCandidate)

      // Verify that we can apply the class
      for (let [, rule] of rules) {
        if (rule.type === 'atrule') {
          continue
        }

        rule.walkRules(() => {
          throw apply.error(
            [
              `The \`${applyCandidate}\` class cannot be used with \`@apply\` because \`@apply\` does not currently support nested CSS.`,
              'Rewrite the selector without nesting or configure the `tailwindcss/nesting` plugin:',
              'https://tailwindcss.com/docs/using-with-preprocessors#nesting',
            ].join('\n')
          )
        })
      }

      candidates.push([applyCandidate, important, rules])
    }
  }

  for (let [parent, [candidates, atApplySource]] of perParentApplies) {
    let siblings = []

    for (let [applyCandidate, important, rules] of candidates) {
      let potentialApplyCandidates = [
        applyCandidate,
        ...extractBaseCandidates([applyCandidate], context.tailwindConfig.separator),
      ]

      for (let [meta, node] of rules) {
        let parentClasses = extractClasses(parent)
        let nodeClasses = extractClasses(node)