Skip to content

Conversation

@scamiv
Copy link
Contributor

@scamiv scamiv commented Feb 8, 2026

Description:

Switch Vite's production minification from esbuild to Terser to improve shipped
bundle minification.

Changes:

  • Production builds: build.minify: "terser" + Terser options (mangle, strip comments, compress.passes: 2)
  • Dev builds: minification disabled
  • Source maps: enabled for non-production builds
  • Add terser devDependency

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory
  • I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced

Please put your Discord username so you can be contacted if a bug or regression is found:

DISCORD_USERNAME

- Add terser devDependency and set build.minify to "terser" in production
- Enable source maps only for non-production builds
- Disable minification for dev builds
- Terser options: mangle names, strip comments, 2 compress passes
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 8, 2026

Walkthrough

Adds terser as a devDependency and updates Vite build config to enable source maps in non-production and use terser minification with top-level mangling and stronger compression in production.

Changes

Cohort / File(s) Summary
Build tooling & Vite config
package.json, vite.config.ts
Added devDependency terser@^5.46.0. Vite build now sets sourcemap: !isProduction, minify: isProduction ? "terser" : false, and terserOptions with compress: { passes: 3 }, mangle: { toplevel: true }, format: { comments: false }.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

⚙️ A tiny tweak to trim and trace,
Terser whispers, code falls into place.
Sourcemaps guide the curious light,
Prod is lean, dev keeps sight—
Build sings cleaner, small and bright. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: switching to Terser for production minification, which is the core objective of the PR.
Description check ✅ Passed The description is directly related to the changeset, explaining the motivation for switching minifiers and listing specific changes made to package.json and vite.config.ts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


No actionable comments were generated in the recent review. 🎉


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@vite.config.ts`:
- Around line 100-109: The terser config currently sets
terserOptions.format.comments = false which strips all comments (including
required license headers); update the vite minify/terser options so license
comments are preserved by changing terserOptions.format.comments to "some" or a
regex that matches license banners, or alternatively add a Rollup plugin (e.g.,
a license extraction plugin) to collect and emit third‑party licenses into a
LICENSE file while keeping terserOptions.format.comments set to allow banner
preservation; locate the minify block/terserOptions in vite.config.ts (the
isProduction conditional) and adjust format.comments or add the license
extraction plugin accordingly.
🧹 Nitpick comments (1)
vite.config.ts (1)

101-109: Small note: mangle: true is already the terser default.

Not a problem — being explicit is fine for readability. Just mentioning it so you know it can be removed if you prefer less config noise.

Comment on lines 100 to 109
minify: isProduction ? "terser" : false,
...(isProduction && {
terserOptions: {
compress: { passes: 2 },
mangle: true,
format: {
comments: false,
},
},
}),
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Risk: comments: false strips license comments from bundled libraries.

Setting format.comments: false removes all comments, including license and legal notices from third-party packages (pixi.js, howler, zod, protobufjs, etc.). Many open-source licenses (MIT, Apache-2.0, BSD) require attribution to be preserved in distributed code. Stripping them may violate license terms.

Use comments: "some" or a regex to keep license banners, or pair this with a plugin like rollup-plugin-license to extract them into a separate LICENSE file in the output.

Suggested fix — keep license comments
       terserOptions: {
         compress: { passes: 2 },
         mangle: true,
         format: {
-          comments: false,
+          comments: /^\/*!/,  // keep comments starting with /*! (license banners)
         },
       },

Or extract all licenses into a separate file using a Rollup plugin, which keeps the bundle clean and stays compliant.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
minify: isProduction ? "terser" : false,
...(isProduction && {
terserOptions: {
compress: { passes: 2 },
mangle: true,
format: {
comments: false,
},
},
}),
minify: isProduction ? "terser" : false,
...(isProduction && {
terserOptions: {
compress: { passes: 2 },
mangle: true,
format: {
comments: /^\/*!/, // keep comments starting with /*! (license banners)
},
},
}),
🤖 Prompt for AI Agents
In `@vite.config.ts` around lines 100 - 109, The terser config currently sets
terserOptions.format.comments = false which strips all comments (including
required license headers); update the vite minify/terser options so license
comments are preserved by changing terserOptions.format.comments to "some" or a
regex that matches license banners, or alternatively add a Rollup plugin (e.g.,
a license extraction plugin) to collect and emit third‑party licenses into a
LICENSE file while keeping terserOptions.format.comments set to allow banner
preservation; locate the minify block/terserOptions in vite.config.ts (the
isProduction conditional) and adjust format.comments or add the license
extraction plugin accordingly.

@github-project-automation github-project-automation bot moved this from Triage to Development in OpenFront Release Management Feb 8, 2026
- Update Terser options to enable top-level mangling and increase compression passes from 2 to 3.
- Improve minification by dropping unused top-level variables and functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development

Development

Successfully merging this pull request may close these issues.

1 participant