Skip to content

Conversation

@JSerFeng
Copy link
Contributor

Summary

Introducing new output.environment.methodShorthand. If target environment support this, module factories will be rendered as object method shorthand form.

Before

__webapck_modules__ = {
  "./src/app.ts": function() {}
}

This PR:

__webpack_modules__ = {
"./src/app.ts"() {}
}

Related links

Checklist

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

Copilot AI review requested due to automatic review settings November 18, 2025 07:07
@JSerFeng JSerFeng requested a review from hardfist as a code owner November 18, 2025 07:07
@github-actions github-actions bot added team The issue/pr is created by the member of Rspack. release: feature release: feature related release(mr only) labels Nov 18, 2025
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 introduces support for ES2015 object method shorthand syntax in module factory definitions to reduce bundle size. When the target environment supports this feature, module factories are rendered using shorthand notation instead of the traditional function property syntax.

Key Changes

  • Module factories now use shorthand syntax ("./src/app.ts"() {}) instead of traditional function properties ("./src/app.ts": function() {})
  • This optimization reduces bundle size by eliminating the : function portion of each module factory definition

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

@netlify
Copy link

netlify bot commented Nov 18, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 4dae46c
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/691d4421b02e610008a4ee7f

@github-actions
Copy link
Contributor

github-actions bot commented Nov 18, 2025

📦 Binary Size-limit

Comparing 4dae46c to fix: should inject prefetch startup in entry chunk instead of runtime chunk (#12233) by harpsealjs

❌ Size increased by 1.00KB from 47.48MB to 47.48MB (⬆️0.00%)

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 18, 2025

CodSpeed Performance Report

Merging #12226 will not alter performance

Comparing fix/use-shorthand-require (4dae46c) with main (0b8a3bb)

Summary

✅ 17 untouched

@JSerFeng JSerFeng force-pushed the fix/use-shorthand-require branch from 1d24028 to 27674f7 Compare November 18, 2025 08:43
@JSerFeng JSerFeng requested a review from h-a-n-a as a code owner November 18, 2025 08:43
@JSerFeng JSerFeng force-pushed the fix/use-shorthand-require branch 2 times, most recently from 575336c to 36fd48b Compare November 18, 2025 09:21
@JSerFeng JSerFeng force-pushed the fix/use-shorthand-require branch from 36fd48b to 4dae46c Compare November 19, 2025 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants