Skip to content

Comments

feat!: do not minify Node bundles#6922

Merged
chenjiahan merged 1 commit intomainfrom
node_minify_0107
Jan 7, 2026
Merged

feat!: do not minify Node bundles#6922
chenjiahan merged 1 commit intomainfrom
node_minify_0107

Conversation

@chenjiahan
Copy link
Member

Summary

For Node targets, production builds no longer enable minification by default.

Server bundles prioritize debuggability, clear stack traces, and stable runtime behavior over bundle size. Minification remains available as an explicit opt-in via output.minify: true

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings January 7, 2026 10:32
@netlify
Copy link

netlify bot commented Jan 7, 2026

Deploy Preview for rsbuild-v2 ready!

Name Link
🔨 Latest commit 29ecba2
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild-v2/deploys/695e363ed2afe50008306f38
😎 Deploy Preview https://deploy-preview-6922--rsbuild-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @chenjiahan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request modifies the build process to disable minification by default for Node.js targets in production environments. The change aims to improve the debuggability and stability of server-side bundles, where clear stack traces and predictable runtime behavior are often more critical than minimal bundle size. While minification is no longer the default, it remains an available option for users who wish to explicitly enable it. Additionally, the update ensures consistent CSS output between server and client builds for better SSR compatibility.

Highlights

  • Default Minification for Node.js Targets: Production builds for Node.js targets will no longer have minification enabled by default. This prioritizes debuggability and stable runtime behavior over bundle size for server-side applications.
  • Explicit Opt-in for Minification: Minification for Node.js targets can still be explicitly enabled by setting output.minify: true in the configuration.
  • Consistent CSS Output for SSR: The CSS plugin now ensures that when building for Node.js, CSS minification settings (and browserslist) are inherited from the web environment's configuration. This maintains consistency between server-side rendering (SSR) and client-side hydration.
  • Configuration and Test Updates: Internal configuration defaults have been adjusted, and corresponding snapshot tests have been updated to reflect the new default behavior of not minifying Node.js bundles.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly implements the disabling of minification by default for Node.js bundles. The core logic change in packages/core/src/plugins/minimize.ts is clear and effectively sets the new default behavior based on the output target. The related changes, such as updating the CSS plugin to ensure consistency between server and client builds, and adjusting type definitions and tests, are all consistent with the main goal. The code quality is high, and the breaking change is appropriately marked. Overall, this is a solid improvement that enhances debuggability for server-side code.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR changes the default minification behavior for Node.js targets to prioritize debuggability and clear stack traces over bundle size. Minification is now disabled by default for target: 'node' in production builds, while remaining enabled by default for web and web-worker targets. Users can still explicitly enable minification for Node bundles via output.minify: true.

Key Changes

  • Minification default is now target-dependent: disabled for node, enabled for web and web-worker in production
  • CSS minification for SSR builds now follows the web environment's settings to ensure consistency
  • The minify property was removed from NormalizedOutputConfig as it's now computed dynamically

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/core/src/plugins/minimize.ts Implements target-dependent default minification logic (false for node, true for web/web-worker)
packages/core/src/plugins/css.ts Updates CSS minification for SSR to use web environment's settings for consistency
packages/core/src/defaultConfig.ts Removes hardcoded minify: true default from output config
packages/core/src/types/config.ts Removes minify from NormalizedOutputConfig interface (now computed dynamically)
packages/core/tests/snapshots/environments.test.ts.snap Updates snapshots to remove minify: true from normalized config output
e2e/cases/polyfill/dirname-filename-node/index.test.ts Updates test expectations to match unminified node bundle output (single quotes, spacing)
e2e/cases/plugin-vue/sfc-css-modules-ssr/index.test.ts Updates test expectations to match unminified node bundle output (backticks instead of quotes)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chenjiahan chenjiahan merged commit ae4f754 into main Jan 7, 2026
16 checks passed
@chenjiahan chenjiahan deleted the node_minify_0107 branch January 7, 2026 10:41
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