-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
fix(schema): allow disabling cssnano/autoprefixer postcss plugins #33016
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
Conversation
|
@nuxt/kit
nuxt
@nuxt/rspack-builder
@nuxt/schema
@nuxt/vite-builder
@nuxt/webpack-builder
commit: |
CodSpeed Performance ReportMerging #33016 will not alter performanceComparing Summary
|
WalkthroughThe 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 unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
: Allowingfalse
for built-in PostCSS plugins matches the PR intentTyping
autoprefixer
/cssnano
asfalse | <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
orcssnano: false
disables the built-in plugins for clarity in generated docs.
1915-1915
: Consider allowingfalse
here for consistency with PostCSS semanticsIn
webpack.postcss.postcssOptions.plugins
,autoprefixer
/cssnano
are typed as options only. If users pass through a PostCSS-style config object whereplugin: 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.
📒 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 – LGTMSwitching to
AutoprefixerOptions
/CssnanoOptions
aliases makes the intent obvious in downstream types and docs.
27-27
: Descriptive alias for webpack-dev-middleware options – LGTMUsing
WebpackDevMiddlewareOptions
reads better and avoids the genericOptions
ambiguity.
1920-1920
: Type alias rename for dev middleware options – LGTMGeneric parameters remain unchanged, so this is a pure naming clarity improvement.
🔗 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.