Skip to content

fix: fix windows build command basign on --mode [mode] flag#5841

Merged
jocelynlin-wd merged 4 commits intoFlowiseAI:mainfrom
sohaieb:feat/fix-agentflow-windows-system-build-issue
Feb 25, 2026
Merged

fix: fix windows build command basign on --mode [mode] flag#5841
jocelynlin-wd merged 4 commits intoFlowiseAI:mainfrom
sohaieb:feat/fix-agentflow-windows-system-build-issue

Conversation

@sohaieb
Copy link
Contributor

@sohaieb sohaieb commented Feb 24, 2026

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @sohaieb, 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 resolves a critical build failure on Windows environments by refactoring how environment variables are passed to Vite commands. Instead of directly injecting NODE_ENV, the project now leverages Vite's native --mode flag, ensuring consistent and reliable build and development processes across different operating systems. This change enhances the robustness of the build system and adheres to recommended Vite practices.

Highlights

  • Windows Build Fix: Resolved an issue preventing pnpm build and pnpm build-force commands from working on Windows systems, which was caused by direct NODE_ENV injection.
  • Vite Mode Adoption: Migrated environment variable handling from direct NODE_ENV setting to using Vite's --mode flag for build and dev scripts, improving cross-platform compatibility.
  • Vite Config Update: Modified vite.config.ts to properly consume the mode parameter from defineConfig, aligning with the updated script commands.
Changelog
  • packages/agentflow/package.json
    • Updated build script to use vite build --mode production instead of NODE_ENV=production vite build.
    • Updated dev script to use vite --mode development instead of NODE_ENV=development vite.
    • Updated dev:example script to use vite --config examples/vite.config.ts --mode development instead of NODE_ENV=development vite --config examples/vite.config.ts.
  • packages/agentflow/vite.config.ts
    • Refactored defineConfig to accept a mode parameter.
    • Changed isDev variable assignment to derive its value from the mode parameter instead of process.env.NODE_ENV.
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 resolves a build issue on Windows by adopting Vite's --mode flag instead of setting NODE_ENV directly in npm scripts. This change ensures cross-platform compatibility for the build and development commands. The vite.config.ts is also properly updated to use a function configuration, accessing the mode passed by Vite. The implementation is clean and effective.

@sohaieb sohaieb closed this Feb 24, 2026

const isDev = process.env.NODE_ENV === 'development'
export default defineConfig(({ mode }) => {
const isDev = mode === 'development'
Copy link
Contributor

Choose a reason for hiding this comment

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

based on the doc you shared https://vite.dev/guide/env-and-mode#modes, we don't even need to pass in mode since build script will by default be production

Copy link
Contributor Author

@sohaieb sohaieb Feb 25, 2026

Choose a reason for hiding this comment

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

Hi
You are completely right @jocelynlin-wd , thank you for the catch !

Basing on the following announced remark in Vite - Env and Mode Doc:

By default, the dev server (dev command) runs in development mode and the build command runs in production mode.

I will keep the code above as we still need it to specify the sourceMap config according to the environment/mode, but I will adjust the package.json scripts instead.

Copy link
Contributor Author

@sohaieb sohaieb Feb 25, 2026

Choose a reason for hiding this comment

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

Hi again @jocelynlin-wd ,
I made the updates according to our discussion,

In the meanwhile, another topic: I created another PR to add LMStudio support too and it fixes some UI issues.

I would really appreciate a lot if you review both PRs 😃
Thank you so much 🙏

@sohaieb sohaieb reopened this Feb 25, 2026
@sohaieb sohaieb force-pushed the feat/fix-agentflow-windows-system-build-issue branch from 7e47d85 to 3fb8d3a Compare February 25, 2026 09:31
@sohaieb sohaieb force-pushed the feat/fix-agentflow-windows-system-build-issue branch from 3fb8d3a to 1893870 Compare February 25, 2026 15:49
@ginna-baker
Copy link
Collaborator

Great idea. Thanks for bringing this up and putting in a better environment check than what I had originally 🙏

Copy link
Collaborator

@ginna-baker ginna-baker left a comment

Choose a reason for hiding this comment

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

Looking great

Copy link
Contributor

@jocelynlin-wd jocelynlin-wd left a comment

Choose a reason for hiding this comment

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

thanks for the fix

@sohaieb
Copy link
Contributor Author

sohaieb commented Feb 25, 2026

Great idea. Thanks for bringing this up and putting in a better environment check than what I had originally 🙏

thank you very much !

thanks for the fix

It's really a pleasure to collaborate!

@sohaieb sohaieb force-pushed the feat/fix-agentflow-windows-system-build-issue branch from 1bac5fb to 175d1c5 Compare February 25, 2026 21:11
@sohaieb sohaieb force-pushed the feat/fix-agentflow-windows-system-build-issue branch from 553f770 to b7e87f7 Compare February 25, 2026 21:54
@jocelynlin-wd jocelynlin-wd merged commit 0cbdb25 into FlowiseAI:main Feb 25, 2026
3 checks passed
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.

3 participants