Skip to content

Disable useless webpack minification in dev mode#213

Open
cteyton wants to merge 2 commits intomainfrom
claude/check-dev-minification-TBVzD
Open

Disable useless webpack minification in dev mode#213
cteyton wants to merge 2 commits intomainfrom
claude/check-dev-minification-TBVzD

Conversation

@cteyton
Copy link
Contributor

@cteyton cteyton commented Mar 14, 2026

Summary
Disable dev minification: Changed minimize: true (hardcoded) to minimize: process.env['NODE_ENV'] === 'production' in apps/api/webpack.config.js, so TerserPlugin no longer runs during development builds
Ensure production builds still minify: Added NODE_ENV: production to the API build step in .github/workflows/build.yml (the frontend already had this; the MCP server doesn't need it since esbuild defaults to production config)

claude added 2 commits March 14, 2026 08:35
The optimization.minimize was hardcoded to true, causing TerserPlugin
to run even in dev builds. This slows down development builds for no
benefit. Now minification only runs when NODE_ENV=production.

Co-Authored-By: Claude <noreply@anthropic.com>

https://claude.ai/code/session_01QzPz5qNFAMFaYo8YDkkFU8
The API webpack config now conditionally minifies based on NODE_ENV.
Without this, CI builds would produce unminified output since NODE_ENV
was not explicitly set (unlike the frontend build which already had it).

Co-Authored-By: Claude <noreply@anthropic.com>

https://claude.ai/code/session_01QzPz5qNFAMFaYo8YDkkFU8
@cteyton cteyton marked this pull request as ready for review March 14, 2026 08:50
@cteyton cteyton changed the title Claude/check dev minification tb vz d Disable useless webpack minification in dev mode Mar 14, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 14, 2026

Greptile Summary

This PR disables TerserPlugin minification during development builds by making minimize conditional on NODE_ENV === 'production' in the API webpack config, and ensures CI production builds are unaffected by setting NODE_ENV: production in the GitHub Actions workflow.

  • Dev build performance: Skipping minification in development reduces build time and improves debugging with readable output.
  • Production parity maintained: The CI workflow now explicitly sets NODE_ENV: production for the API build step, matching the existing pattern used by the frontend build. The Dockerfile also sets NODE_ENV=production at runtime.
  • Consistent approach: The minimize toggle uses the same process.env['NODE_ENV'] check already used for the webpack mode setting on line 19 of the config.

Confidence Score: 5/5

  • This PR is safe to merge — it's a minimal, well-scoped configuration change with no risk to production behavior.
  • Only two lines changed across two files. The webpack change follows an existing pattern in the same file, and the CI change mirrors what the frontend build already does. No logic changes, no new dependencies, and production builds remain minified.
  • No files require special attention.

Important Files Changed

Filename Overview
apps/api/webpack.config.js Changed minimize from hardcoded true to process.env['NODE_ENV'] === 'production', consistent with how mode is already determined on line 19. No issues found.
.github/workflows/build.yml Added NODE_ENV: production to the API build step, matching the existing pattern used by the frontend build step. Ensures CI production builds still get minified.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[webpack build starts] --> B{NODE_ENV === 'production'?}
    B -->|Yes - CI / production| C[minimize: true]
    B -->|No - local dev| D[minimize: false]
    C --> E[TerserPlugin runs]
    E --> F[Minified main.js]
    D --> G[Skip TerserPlugin]
    G --> H[Unminified main.js]

    style C fill:#22c55e,color:#fff
    style D fill:#3b82f6,color:#fff
    style F fill:#22c55e,color:#fff
    style H fill:#3b82f6,color:#fff
Loading

Last reviewed commit: a64ae9b

@sonarqubecloud
Copy link

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.

2 participants