Skip to content

Conversation

@leoortizz
Copy link
Member

Description

This PR adds support for the next build --webpack command in the Next.js framework integration. With Next.js 16 defaulting to Turbopack, this change allows users to explicitly opt-out and force Webpack usage by defining "build": "next build --webpack" in their package.json.

Previously, firebase deploy would ignore this flag and warn about a custom build script. This update detects the flag, forwards it to the build process, and suppresses the warning for this specific valid configuration.

Fixes #9749

Scenarios Tested

  • Standard Build: Verified that "build": "next build" continues to work as expected without warnings.
  • Webpack Opt-in: Verified that "build": "next build --webpack" correctly forwards the --webpack flag to the build command and suppresses the custom script warning.
  • Custom Scripts: Verified that unsupported custom scripts (e.g., "build": "next build --verbose") still trigger the standard warning and do not forward arbitrary flags.
  • Unit Tests: Added unit tests for the new getBuildScript utility and verified existing tests pass.

Sample Commands

Users can now use the following in their package.json:

{
  "scripts": {
     "build": "next build --webpack"
   }
}

- Add `getBuildScript` utility to read build scripts from package.json.
- Update Next.js framework adapter to detect `next build --webpack`.
- Add `--webpack` flag to the build process if detected in the script.
- Suppress custom build script warning for valid webpack configurations.
- Preserve existing `warnIfCustomBuildScript` behavior for compatibility with other frameworks.

Fixes #9749
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @leoortizz, 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 significantly improves the Firebase CLI's handling of Next.js projects by adding explicit support for the next build --webpack command. This change ensures that users who wish to use Webpack for their Next.js builds, particularly in light of Next.js 16's default to Turbopack, can do so without encountering warnings or unexpected behavior from the CLI. The underlying implementation involves a new utility for build script detection and a refactoring of the custom build script warning mechanism, making the framework integrations more robust and user-friendly.

Highlights

  • Next.js Webpack Flag Support: The Firebase CLI's Next.js framework integration now officially supports the next build --webpack command, allowing users to explicitly opt for Webpack instead of the default Turbopack.
  • Warning Suppression: The CLI will no longer issue a warning for next build --webpack as a custom build script, recognizing it as a valid configuration.
  • Build Script Detection Utility: A new utility function, getBuildScript, has been introduced to reliably extract the build script from package.json.
  • Refactored Warning Logic: The warnIfCustomBuildScript function has been refactored to accept the build script directly, improving its reusability and testability across different frameworks.
  • Framework-wide Integration: The new getBuildScript utility and refactored warning logic have been integrated into Angular, Astro, Nuxt, and Vite framework handlers for consistency.
  • Comprehensive Testing: New unit tests have been added for getBuildScript, and existing tests for warnIfCustomBuildScript have been updated to reflect the changes.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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 adds support for the next build --webpack flag, which is a valuable addition. The refactoring to use a central getBuildScript utility is well-executed. However, I've identified a critical issue in the Next.js implementation that would prevent the feature from working as intended, along with some minor issues in the updated tests. My review includes suggestions to address these points.

@leoortizz leoortizz marked this pull request as draft January 19, 2026 16:19
@leoortizz leoortizz marked this pull request as ready for review January 19, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

firebase deploy is ignoring next build flags

1 participant