Skip to content

perf: optimize the runtime size with swc minify config#24

Merged
chenjiahan merged 1 commit intomainfrom
syt/optimize-size
Jul 2, 2025
Merged

perf: optimize the runtime size with swc minify config#24
chenjiahan merged 1 commit intomainfrom
syt/optimize-size

Conversation

@SoonIter
Copy link
Copy Markdown
Member

@SoonIter SoonIter commented Jul 2, 2025

perf: optimize the runtime size

image

image

1.9kb -> 1.8kb

image

Copilot AI review requested due to automatic review settings July 2, 2025 07:13
Copy link
Copy Markdown

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 focuses on reducing the runtime bundle size via micro-optimizations and minifier settings.

  • Swapped a for…of loop for an index-based for loop in findMatchingRule
  • Renamed config to rules in load() for consistency
  • Added multi-pass and unsafe compression options to the SWC plugin in the build config

Reviewed Changes

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

File Description
src/runtime/utils/findMatchingRule.ts Replaced for…of with for (i …) and inlined rules[i] lookup
src/runtime/initialChunkRetry.ts Changed load(config, e) to load(rules, e) and updated usage
rslib.config.ts Enabled compress.passes and compress.unsafe in SWC plugin

@SoonIter SoonIter requested a review from chenjiahan July 2, 2025 07:23
@SoonIter SoonIter changed the title perf: optimize the runtime size perf: optimize the runtime size with swc minify config Jul 2, 2025
@chenjiahan chenjiahan merged commit 5dec5fe into main Jul 2, 2025
2 checks passed
@chenjiahan chenjiahan deleted the syt/optimize-size branch July 2, 2025 07:32
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.

3 participants