Skip to content

Conversation

@chenjiahan
Copy link
Member

Summary

This pull request replaces the dotenv dependency with a custom implementation of its parse method to reduce unused functionality.

  • before:
File (esm_index)   Size       
dist/index.js      389.1 kB
  • after:
File (esm_index)   Size       
dist/index.js      377.5 kB

Removed the following lines from the output bundle:

import * as __WEBPACK_EXTERNAL_MODULE_crypto__ from "crypto";
import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
import * as __WEBPACK_EXTERNAL_MODULE_os__ from "os";
import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";

Related Links

https://github.com/motdotla/dotenv/blob/v16.5.0/lib/main.js#L9-L48

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings June 7, 2025 02:12
@netlify
Copy link

netlify bot commented Jun 7, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 29014ca
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68439ff492ea0c0008a1f3ea
😎 Deploy Preview https://deploy-preview-5379--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 76 (🟢 up 4 from production)
Accessibility: 97 (no change from production)
Best Practices: 92 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the environment loading logic by replacing the dotenv dependency with a custom parse function to reduce the output bundle size.

  • Removed the dotenv dependency and its associated import.
  • Introduced a custom parse function to handle .env file parsing.
  • Updated package.json to reflect the removal of the unused dependency.

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/core/src/loadEnv.ts Replaced dotenv’s parse method with a custom implementation.
packages/core/package.json Removed the dotenv dependency to reduce bundle size.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

packages/core/src/loadEnv.ts:19

  • Ensure that the custom parse function is thoroughly covered by tests to validate its behavior against various .env file edge cases.
function parse(src: Buffer) {

@chenjiahan chenjiahan merged commit 312f656 into main Jun 7, 2025
12 checks passed
@chenjiahan chenjiahan deleted the dotenv_remove_0607 branch June 7, 2025 02:36
@chenjiahan chenjiahan mentioned this pull request Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant