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 ready!

Name Link
🔨 Latest commit 7c4bf4b
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/6927f28897d9d3000852b435
😎 Deploy Preview https://deploy-preview-12226--rspack.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 Nov 18, 2025

📦 Binary Size-limit

Comparing 7c4bf4b to perf: disable output.pathinfo by default (#12306) by neverland

❌ Size increased by 8.00KB from 47.67MB to 47.68MB (⬆️0.02%)

@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 (7c4bf4b) with main (4322519)

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 4 times, most recently from 4dae46c to 3851b3c Compare November 24, 2025 04:03
chenjiahan
chenjiahan previously approved these changes Nov 24, 2025
Copy link
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

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

LGTM 👍

chenjiahan
chenjiahan previously approved these changes Nov 27, 2025
@JSerFeng JSerFeng merged commit 9827010 into main Nov 27, 2025
71 of 73 checks passed
@JSerFeng JSerFeng deleted the fix/use-shorthand-require branch November 27, 2025 07:26
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