Skip to content

Enable minification to reduce bundle size#336

Merged
yamcodes merged 2 commits intomainfrom
enable-minification
Nov 10, 2025
Merged

Enable minification to reduce bundle size#336
yamcodes merged 2 commits intomainfrom
enable-minification

Conversation

@yamcodes
Copy link
Owner

@yamcodes yamcodes commented Nov 10, 2025

Summary

This PR enables minification in the build process to reduce bundle size by removing comments and minifying code.

Changes

  • Added minify: true to tsdown.config.ts
  • Enables esbuild minification which removes comments and minifies JavaScript

Results

  • Bundle size reduced from 711 B to 708 B (minified and brotlied)
  • All comments removed from production bundle
  • JSDoc comments remain in source files for TypeScript tooling
  • All tests pass ✅

Notes

JSDoc comments are preserved in source files for TypeScript type checking and IDE hints, but are stripped from the bundle during minification.

Closes #335

Summary by CodeRabbit

  • Chores
    • Enabled minification in the build output to reduce package size.
  • Changelog
    • Added a changeset for a patch release noting bundle size reduced (~711 B → ~708 B) and that comments are stripped from distributed output (source comments remain).

- Add minify: true to tsdown.config.ts
- Removes comments from bundle while preserving JSDoc in source
- Reduces bundle size from 711 B to 708 B

Closes #335
@changeset-bot
Copy link

changeset-bot bot commented Nov 10, 2025

🦋 Changeset detected

Latest commit: a89def5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
arkenv Patch
@arkenv/vite-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Nov 10, 2025

Deployment failed with the following error:

Resource is limited - try again in 46 minutes (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/yamcodes?upgradeToPro=build-rate-limit

@github-actions github-actions bot added the arkenv Changes to the `arkenv` npm package. label Nov 10, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 10, 2025

Walkthrough

A configuration property was added to enable minification and a changeset was added documenting the patch release. The build configuration now includes minify: true in packages/arkenv/tsdown.config.ts; a new .changeset/fruity-onions-clean.md records the bundle-size change and comment stripping.

Changes

Cohort / File(s) Summary
Build configuration
packages/arkenv/tsdown.config.ts
Added minify: true to the exported tsdown configuration to enable code minification (comments stripped from bundle, output minified).
Release changeset
.changeset/fruity-onions-clean.md
New changeset noting a patch release for arkenv, documenting minification enabled and bundle size reduction (711 B → 708 B) and that comments are stripped in the bundle.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Focus review on packages/arkenv/tsdown.config.ts to confirm the config shape and that minify is supported by the tooling.
  • Verify the .changeset/fruity-onions-clean.md content for accuracy and formatting.

Poem

🐰 A tiny tweak, a nimble hop,
Minify true — the bytes now drop.
Comments slip out, the bundle trims,
Hooray for smaller, happier whims! 🥕🎉

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main objective: enabling minification to reduce bundle size, which directly matches the changeset modifications.
Linked Issues check ✅ Passed All coding requirements from issue #335 are met: minify: true added to tsdown.config.ts [#335], comments removed from production bundle [#335], and bundle size reduced [#335].
Out of Scope Changes check ✅ Passed All changes are directly related to the stated objective; the configuration modification and changeset documentation are both within the scope of enabling minification.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch enable-minification

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ab97187 and a89def5.

📒 Files selected for processing (1)
  • .changeset/fruity-onions-clean.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/fruity-onions-clean.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test-e2e (a11y)
  • GitHub Check: test-e2e (e2e)

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.

@arkenv-bot
Copy link
Contributor

arkenv-bot bot commented Nov 10, 2025

📦 Bundle Size Report

Package File Size Limit Diff Status
arkenv index.js 708 B 2 kB -0.4%

All size limits passed!

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 10, 2025

Open in StackBlitz

npm i https://pkg.pr.new/arkenv@336
npm i https://pkg.pr.new/@arkenv/vite-plugin@336

commit: a89def5

- Added minification to the build process, decreasing the bundle size from 711 B to 708 B.
- Comments are removed from the bundle while preserving JSDoc in the source files.

This change enhances performance by optimizing the output size.
@vercel
Copy link

vercel bot commented Nov 10, 2025

Deployment failed with the following error:

Resource is limited - try again in 44 minutes (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/yamcodes?upgradeToPro=build-rate-limit

@github-actions github-actions bot added the docs Improvements or additions to documentation label Nov 10, 2025
@yamcodes yamcodes merged commit 7236cb2 into main Nov 10, 2025
17 of 18 checks passed
@yamcodes yamcodes deleted the enable-minification branch November 10, 2025 15:14
@arkenv-bot arkenv-bot bot mentioned this pull request Nov 10, 2025
yamcodes pushed a commit that referenced this pull request Nov 10, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## arkenv@0.7.4

### Patch Changes

- #### Enable minification to reduce bundle size
_[`#336`](#336)
[`7236cb2`](7236cb2)
[@yamcodes](https://github.com/yamcodes)_

Enable minification in build output. Reduces bundle size from 711 B to
708 B. Comments are removed from the bundle but remain in source files.

- #### Fix browser compatibility by replacing `util.styleText` with
cross-platform ANSI codes
_[`#290`](#290)
[`bf465de`](bf465de)
[@yamcodes](https://github.com/yamcodes)_

Replace Node.js `util.styleText` with cross-platform ANSI color codes to
fix the "Module 'node:util' has been externalized for browser
compatibility" error in browser environments. The library still
maintains zero dependencies!

    **Changes:**

    -   Replaced `node:util.styleText` with custom ANSI implementation
- Added environment detection (uses ANSI in Node, plain text in
browsers)
- Respects `NO_COLOR`, `CI` environment variables, and TTY detection
    -   Organized utilities into `lib/` folder with comprehensive tests

    ```ts
    // No longer throws "node:util has been externalized" error
    import { createEnv } from "arkenv";

    const env = createEnv({
      VITE_API_URL: "string",
      VITE_PORT: "number.port",
    });
    ```

## @arkenv/vite-plugin@0.0.15

### Patch Changes

<details><summary>Updated 1 dependency</summary>

<small>


[`7236cb2`](7236cb2)
[`bf465de`](bf465de)

</small>

-   `arkenv@0.7.4`

</details>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@arkenv-bot arkenv-bot bot mentioned this pull request Nov 10, 2025
yamcodes pushed a commit that referenced this pull request Nov 10, 2025
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [arkenv](https://arkenv.js.org)
([source](https://redirect.github.com/yamcodes/arkenv)) | [`0.7.3` ->
`0.7.4`](https://renovatebot.com/diffs/npm/arkenv/0.7.3/0.7.4) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/arkenv/0.7.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/arkenv/0.7.3/0.7.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>yamcodes/arkenv (arkenv)</summary>

###
[`v0.7.4`](https://redirect.github.com/yamcodes/arkenv/releases/tag/arkenv%400.7.4)

[Compare
Source](https://redirect.github.com/yamcodes/arkenv/compare/arkenv@0.7.3...arkenv@0.7.4)

##### Patch Changes

- #### Enable minification to reduce bundle size
*[`#336`](https://redirect.github.com/yamcodes/arkenv/pull/336)
[`7236cb2`](https://redirect.github.com/yamcodes/arkenv/commit/7236cb25de07f7afcc571dd3364b1507544de523)
[@&#8203;yamcodes](https://redirect.github.com/yamcodes)*

Enable minification in build output. Reduces bundle size from 711 B to
708 B. Comments are removed from the bundle but remain in source files.

- #### Fix browser compatibility by replacing `util.styleText` with
cross-platform ANSI codes
*[`#290`](https://redirect.github.com/yamcodes/arkenv/pull/290)
[`bf465de`](https://redirect.github.com/yamcodes/arkenv/commit/bf465dee26cd20619455bcc77f66424ca48da0fe)
[@&#8203;yamcodes](https://redirect.github.com/yamcodes)*

Replace Node.js `util.styleText` with cross-platform ANSI color codes to
fix the "Module 'node:util' has been externalized for browser
compatibility" error in browser environments. The library still
maintains zero dependencies!

  **Changes:**

  - Replaced `node:util.styleText` with custom ANSI implementation
- Added environment detection (uses ANSI in Node, plain text in
browsers)
  - Respects `NO_COLOR`, `CI` environment variables, and TTY detection
  - Organized utilities into `lib/` folder with comprehensive tests

  ```ts
  // No longer throws "node:util has been externalized" error
  import { createEnv } from "arkenv";

  const env = createEnv({
    VITE_API_URL: "string",
    VITE_PORT: "number.port",
  });
  ```

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on friday" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/yamcodes/arkenv).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNzMuMSIsInVwZGF0ZWRJblZlciI6IjQxLjE3My4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arkenv Changes to the `arkenv` npm package. docs Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable minification to reduce bundle size

1 participant