Skip to content

Conversation

@SoonIter
Copy link
Member

Summary

chore: add sideEffects and fix the eject not work

Related Issue

Checklist

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

Copilot AI review requested due to automatic review settings December 16, 2025 07:57
@netlify
Copy link

netlify bot commented Dec 16, 2025

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit 3edd895
🔍 Latest deploy log https://app.netlify.com/projects/rspress-v2/deploys/694128e25f3e590008bd75f3
😎 Deploy Preview https://deploy-preview-2896--rspress-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 16, 2025

Rsdoctor Bundle Diff Analysis

📁 web

Path: website/doc_build/web/rsdoctor-data.json

📌 Baseline Commit: 6b800772c9 | PR: #2880

Metric Current Baseline Change
📊 Total Size 14.6 MB 14.6 MB 0 B (0.0%)
📄 JavaScript 14.0 MB 14.0 MB 0 B (0.0%)
🎨 CSS 113.7 KB 113.7 KB 0 B (0.0%)
🌐 HTML 0 B 0 B N/A
📁 Other Assets 480.4 KB 480.4 KB 0 B (0.0%)

📦 Download Diff Report: web Bundle Diff

Generated by Rsdoctor GitHub Action

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 adds sideEffects configuration for webpack optimization and fixes a bug in the eject functionality where theme components could not be found due to incorrect path resolution in ESM modules.

Key Changes

  • Fixed eject functionality by using a constant for the ejected theme path instead of computing it with __dirname (which doesn't work correctly in ESM)
  • Added sideEffects: false configuration for the theme index to enable better tree-shaking
  • Added path resolution logic for relative theme directories

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
packages/core/src/node/constants.ts Added EJECTED_THEME constant pointing to the dist/eject-theme directory
packages/core/src/node/eject.ts Fixed eject functionality by using the new EJECTED_THEME constant instead of computing path with __dirname
packages/core/src/node/initRsbuild.ts Added path resolution for relative theme directories, renamed CSS virtual module rule for clarity, and added sideEffects configuration for theme optimization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@SoonIter SoonIter changed the title chore(initRsbuild): add sideEffects and fix the eject not work fix(eject): fix the component path not right Dec 16, 2025
@SoonIter SoonIter force-pushed the syt/sideEffects-false branch from cb430ee to 3edd895 Compare December 16, 2025 09:39
@SoonIter SoonIter changed the title fix(eject): fix the component path not right fix(cli/eject): fix the component path not right Dec 16, 2025
@SoonIter SoonIter enabled auto-merge (squash) December 16, 2025 09:55
@SoonIter SoonIter merged commit 324386d into main Dec 16, 2025
10 checks passed
@SoonIter SoonIter deleted the syt/sideEffects-false branch December 16, 2025 10:47
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.

3 participants