Skip to content

Conversation

danielroe
Copy link
Member

🔗 Linked issue

#33014

📚 Description

investigating #33014, saw that we don't correctly allow falsy types for cssnano/autoprefixer built-ins, even though we do respect them when loading vite/webpack postcss plugins.

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@danielroe danielroe self-assigned this Aug 20, 2025
Copy link

pkg-pr-new bot commented Aug 20, 2025

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@33016

nuxt

npm i https://pkg.pr.new/nuxt@33016

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@33016

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@33016

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@33016

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@33016

commit: eed5fa3

Copy link

codspeed-hq bot commented Aug 20, 2025

CodSpeed Performance Report

Merging #33016 will not alter performance

Comparing fix/postcss-disable (eed5fa3) with main (b86a1c0)

Summary

✅ 10 untouched benchmarks

Copy link

coderabbitai bot commented Aug 20, 2025

Walkthrough

The diff updates TypeScript types in packages/schema/src/types/schema.ts. It replaces generic alias imports with explicit option type names for Autoprefixer, Cssnano, and webpack-dev-middleware. ConfigSchema.plugins now permits disabling autoprefixer and cssnano with false, or configuring them via their respective option types. In postcss.postcssOptions.plugins, autoprefixer and cssnano are typed with their option types (no false union). devMiddleware now uses WebpackDevMiddlewareOptions<IncomingMessage, ServerResponse>. No runtime logic changes are included.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/postcss-disable

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/schema/src/types/schema.ts (2)

1555-1555: Allowing false for built-in PostCSS plugins matches the PR intent

Typing autoprefixer/cssnano as false | <Options> here correctly enables disabling the built-ins via schema, aligning with the linked issue.

Consider updating the JSDoc above to explicitly note that setting autoprefixer: false or cssnano: false disables the built-in plugins for clarity in generated docs.


1915-1915: Consider allowing false here for consistency with PostCSS semantics

In webpack.postcss.postcssOptions.plugins, autoprefixer/cssnano are typed as options only. If users pass through a PostCSS-style config object where plugin: false disables a plugin, the current typing would reject it even if the underlying loader would tolerate it.

If consistent with how Nuxt normalises this field for webpack, widen the types to allow false as well.

Proposed diff:

-    postcss: { execute?: boolean, postcssOptions: ProcessOptions & { plugins: Record<string, unknown> & { autoprefixer?: AutoprefixerOptions, cssnano?: CssnanoOptions } }, sourceMap?: boolean, implementation?: any }
+    postcss: { execute?: boolean, postcssOptions: ProcessOptions & { plugins: Record<string, unknown> & { autoprefixer?: false | AutoprefixerOptions, cssnano?: false | CssnanoOptions } }, sourceMap?: boolean, implementation?: any }

If this omission is intentional (i.e. disabling should only be done at the top-level postcss.plugins that Nuxt consumes for built-ins), we should document that difference to avoid confusion.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b86a1c0 and eed5fa3.

📒 Files selected for processing (1)
  • packages/schema/src/types/schema.ts (4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Follow standard TypeScript conventions and best practices

Files:

  • packages/schema/src/types/schema.ts
🔇 Additional comments (3)
packages/schema/src/types/schema.ts (3)

16-17: Explicit Autoprefixer/Cssnano option aliases improve clarity – LGTM

Switching to AutoprefixerOptions/CssnanoOptions aliases makes the intent obvious in downstream types and docs.


27-27: Descriptive alias for webpack-dev-middleware options – LGTM

Using WebpackDevMiddlewareOptions reads better and avoids the generic Options ambiguity.


1920-1920: Type alias rename for dev middleware options – LGTM

Generic parameters remain unchanged, so this is a pure naming clarity improvement.

@danielroe danielroe merged commit d6ee30e into main Aug 21, 2025
83 of 84 checks passed
@danielroe danielroe deleted the fix/postcss-disable branch August 21, 2025 08:20
@github-actions github-actions bot mentioned this pull request Aug 21, 2025
@github-actions github-actions bot mentioned this pull request Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant