Skip to content

Comments

feat(rolldown_plugin_oxc_runtime)!: embed helpers to support browser environment#6177

Merged
graphite-app[bot] merged 1 commit intomainfrom
09-12-feat_rolldown_plugin_oxc_runtime_embed_helpers_to_support_browser_environment
Sep 12, 2025
Merged

feat(rolldown_plugin_oxc_runtime)!: embed helpers to support browser environment#6177
graphite-app[bot] merged 1 commit intomainfrom
09-12-feat_rolldown_plugin_oxc_runtime_embed_helpers_to_support_browser_environment

Conversation

@shulaoda
Copy link
Member

@shulaoda shulaoda commented Sep 12, 2025

closes #4719

🚀 Breaking Change Alert: Rolldown's OXC Runtime Plugin Now Embeds Helpers Directly!

We've revolutionized how Rolldown handles OXC transform helpers with an even better solution:

Before:

  • Automatic dependency resolution from @oxc-project/runtime (~229 KB)
  • Runtime module resolution required
  • External package dependency in node_modules
  • Browser environments struggled with module resolution

After:

  • Helpers embedded directly in Rolldown binary - zero external dependencies!
  • Only ~25 KB added to binary size (91% smaller than 229 KB package!)
  • Works seamlessly in ALL environments including browsers
  • Lightning-fast: Memory access instead of file I/O - instant helper loading!
  • Still no manual installation needed - but now even more efficient!

This enhancement makes Rolldown more self-contained and efficient. The OXC runtime helpers are now truly part of the core binary, providing better performance and reliability while maintaining the same seamless developer experience.

The transition is automatic - Rolldown continues to handle everything for you, just more efficiently! 🎉

Copy link
Member Author

shulaoda commented Sep 12, 2025


How to use the Graphite Merge Queue

Add the label graphite: merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@netlify
Copy link

netlify bot commented Sep 12, 2025

Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit ed8130d
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/68c456e0150a27000866486d
😎 Deploy Preview https://deploy-preview-6177--rolldown-rs.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.

@shulaoda shulaoda force-pushed the 09-12-feat_rolldown_plugin_oxc_runtime_embed_helpers_to_support_browser_environment branch from 2216aca to 054aec1 Compare September 12, 2025 07:05
@shulaoda shulaoda marked this pull request as ready for review September 12, 2025 07:05
@shulaoda shulaoda marked this pull request as draft September 12, 2025 07:10
@shulaoda shulaoda force-pushed the 09-12-feat_rolldown_plugin_oxc_runtime_embed_helpers_to_support_browser_environment branch 2 times, most recently from 2f3ab52 to f81a021 Compare September 12, 2025 07:32
@github-actions
Copy link
Contributor

github-actions bot commented Sep 12, 2025

Benchmarks Rust

  • target: main(3874f42)
  • pr: 09-12-feat_rolldown_plugin_oxc_runtime_embed_helpers_to_support_browser_environment(ed8130d)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.00     83.3±2.13ms        ? ?/sec    1.00     83.1±2.84ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.00     93.6±1.92ms        ? ?/sec    1.00     93.8±2.42ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00    122.6±2.78ms        ? ?/sec    1.00    123.1±2.23ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.00    143.0±2.49ms        ? ?/sec    1.01    144.1±2.16ms        ? ?/sec
bundle/bundle@threejs                                        1.00     45.8±1.06ms        ? ?/sec    1.03     46.9±2.98ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.00     54.9±0.95ms        ? ?/sec    1.02     55.8±1.22ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    484.1±8.93ms        ? ?/sec    1.00    482.2±7.77ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.01    566.3±7.06ms        ? ?/sec    1.00    559.3±5.63ms        ? ?/sec
scan/scan@rome_ts                                            1.00     96.8±1.56ms        ? ?/sec    1.00     96.6±1.62ms        ? ?/sec
scan/scan@threejs                                            1.00     34.4±0.57ms        ? ?/sec    1.00     34.3±0.51ms        ? ?/sec
scan/scan@threejs10x                                         1.00    360.9±6.26ms        ? ?/sec    1.00    361.0±4.58ms        ? ?/sec

@hyf0
Copy link
Member

hyf0 commented Sep 12, 2025

After all, a feature gate should be required. I guess we could enable it by default.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 12, 2025

Open in StackBlitz

@rolldown/browser

npm i https://pkg.pr.new/@rolldown/browser@6177

@rolldown/debug

npm i https://pkg.pr.new/@rolldown/debug@6177

@rolldown/pluginutils

npm i https://pkg.pr.new/@rolldown/pluginutils@6177

rolldown

npm i https://pkg.pr.new/rolldown@6177

@rolldown/binding-android-arm64

npm i https://pkg.pr.new/@rolldown/binding-android-arm64@6177

@rolldown/binding-darwin-arm64

npm i https://pkg.pr.new/@rolldown/binding-darwin-arm64@6177

@rolldown/binding-darwin-x64

npm i https://pkg.pr.new/@rolldown/binding-darwin-x64@6177

@rolldown/binding-freebsd-x64

npm i https://pkg.pr.new/@rolldown/binding-freebsd-x64@6177

@rolldown/binding-linux-arm-gnueabihf

npm i https://pkg.pr.new/@rolldown/binding-linux-arm-gnueabihf@6177

@rolldown/binding-linux-arm64-gnu

npm i https://pkg.pr.new/@rolldown/binding-linux-arm64-gnu@6177

@rolldown/binding-linux-arm64-musl

npm i https://pkg.pr.new/@rolldown/binding-linux-arm64-musl@6177

@rolldown/binding-linux-x64-gnu

npm i https://pkg.pr.new/@rolldown/binding-linux-x64-gnu@6177

@rolldown/binding-linux-x64-musl

npm i https://pkg.pr.new/@rolldown/binding-linux-x64-musl@6177

@rolldown/binding-openharmony-arm64

npm i https://pkg.pr.new/@rolldown/binding-openharmony-arm64@6177

@rolldown/binding-wasm32-wasi

npm i https://pkg.pr.new/@rolldown/binding-wasm32-wasi@6177

@rolldown/binding-win32-arm64-msvc

npm i https://pkg.pr.new/@rolldown/binding-win32-arm64-msvc@6177

@rolldown/binding-win32-ia32-msvc

npm i https://pkg.pr.new/@rolldown/binding-win32-ia32-msvc@6177

@rolldown/binding-win32-x64-msvc

npm i https://pkg.pr.new/@rolldown/binding-win32-x64-msvc@6177

commit: f81a021

@sapphi-red
Copy link
Member

After all, a feature gate should be required. I guess we could enable it by default.

@hyf0 What is the reason to put it behind a feature?

@hyf0
Copy link
Member

hyf0 commented Sep 12, 2025

After all, a feature gate should be required. I guess we could enable it by default.

@hyf0 What is the reason to put it behind a feature?

Just in case. Think again, maybe not. Since it's the future we want, we should just fix possible bugs directly based on this feature.

@sapphi-red
Copy link
Member

If we want to give a way for users opt-out this in case of bugs, I think we should add a temporary option instead of a feature gate. (or did you mean an option by feature gate?)
But I guess it's fine without an option.

@hyf0
Copy link
Member

hyf0 commented Sep 12, 2025

If we want to give a way for users opt-out this in case of bugs, I think we should add a temporary option instead of a feature gate. (or did you mean an option by feature gate?) But I guess it's fine without an option.

Oh yeah. I mean a option in experimentalOptions, not a rust featrue gate.

@shulaoda shulaoda force-pushed the 09-12-feat_rolldown_plugin_oxc_runtime_embed_helpers_to_support_browser_environment branch from f81a021 to 4341864 Compare September 12, 2025 10:26
@shulaoda shulaoda marked this pull request as ready for review September 12, 2025 10:28
@shulaoda shulaoda requested a review from hyf0 September 12, 2025 10:28
@graphite-app
Copy link
Contributor

graphite-app bot commented Sep 12, 2025

Merge activity

  • Sep 12, 11:07 AM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • Sep 12, 11:07 AM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..
  • Sep 12, 5:22 PM UTC: shulaoda added this pull request to the Graphite merge queue.
  • Sep 12, 5:31 PM UTC: Merged by the Graphite merge queue.

@shulaoda shulaoda force-pushed the 09-12-feat_rolldown_plugin_oxc_runtime_embed_helpers_to_support_browser_environment branch from 4341864 to cf9a464 Compare September 12, 2025 11:24
@shulaoda shulaoda force-pushed the 09-12-feat_rolldown_plugin_oxc_runtime_embed_helpers_to_support_browser_environment branch from cf9a464 to 840b3e1 Compare September 12, 2025 11:24
@graphite-app graphite-app bot force-pushed the 09-12-feat_rolldown_plugin_oxc_runtime_embed_helpers_to_support_browser_environment branch from 840b3e1 to ed8130d Compare September 12, 2025 17:22
@socket-security
Copy link

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedis-even@​1.0.01001008378100
Addedis-odd@​0.1.21001008178100
Addedkind-of@​3.2.210010010080100
Addedis-number@​3.0.01001009881100

View full report

@graphite-app graphite-app bot merged commit ed8130d into main Sep 12, 2025
29 checks passed
@graphite-app graphite-app bot deleted the 09-12-feat_rolldown_plugin_oxc_runtime_embed_helpers_to_support_browser_environment branch September 12, 2025 17:31
shulaoda pushed a commit that referenced this pull request Sep 15, 2025
## [1.0.0-beta.38] - 2025-09-15

📦 OXC Runtime Helpers Now Embedded

- Instant loading: Memory access instead of file I/O
- 91% smaller: From 229 KB external package to ~25 KB in binary
- Universal support: Works seamlessly in all environments including browsers
- Zero dependencies: Helpers embedded directly, no `@oxc-project/runtime` needed

⚡ Windows Performance Boost

- ~10% faster bundling on Windows
- Powered by `oxc-resolver` optimizations

Both improvements require zero configuration - just update to the latest version and enjoy! 🎉

> [!warning] 
> ### 💥 BREAKING CHANGES
> - rolldown_plugin_oxc_runtime: embed helpers to support browser environment (#6177) by @shulaoda

### 🚀 Features

- rolldown: oxc v0.89.0 (#6220) by @Boshen
- rolldown_plugin_esm_external_require: add duplicate external detection (#6202) by @shulaoda
- cross module noop function optimization (#6199) by @IWANABETHATGUY
- support to specify `scan_mode` in `bundler.scan` (#6204) by @IWANABETHATGUY
- warn when transform options override tsconfig compiler options (#6197) by @shulaoda
- support `false` in `resolve.alias` to ignore resolution (#6203) by @shulaoda
- cli: remove `getJsonSchema` (#6186) by @shulaoda
- cli: add Node.js version warning for unsupported versions (#6150) by @Copilot
- rolldown_plugin_oxc_runtime: include version in virtual module paths (#6179) by @shulaoda
- add native react-refresh-wrapper plugin (#6144) by @sapphi-red
- rolldown_plugin_utils: add `to_string_literal` (#6178) by @sapphi-red
- improve error messages for builtin plugins (#6175) by @shulaoda
- indent module content in IIFE format (#6174) by @IWANABETHATGUY
- rolldown_error: improve N-API error handling logic (#6171) by @shulaoda
- rolldown_error: improve `ByteLocator#byte_offset` (#6169) by @shulaoda
- dev: skip writing to file (#6148) by @sapphi-red
- dev: add `skip_write` option (#6151) by @sapphi-red
- dev: ignore file metadata changes (#6138) by @sapphi-red
- dev: add PathsMut for debounced PollWatcher (#6139) by @sapphi-red
- dev: use PathsMut for debounced RecommendedWatcher (#6137) by @sapphi-red
- improve bundler initialization error handling (#6132) by @shulaoda

### 🐛 Bug Fixes

- rolldown_plugin_vite_resolve: correctly handle Windows drive paths with leading slash (#6209) by @shulaoda
- allow `jsx.pragmaFrag` instead of `jsx.pragmaFlag` (#6200) by @sapphi-red
- improve import-glob plugin error handling without panic (#6106) by @hikomoon
- Panic with "jsx": "preserve" when rewrite a `memberExpression` (#6192) by @IWANABETHATGUY
- rolldown_error: use `byte_slice` instead of `slice` for correct span handling (#6185) by @shulaoda
- generate valid identifier for export names with `minifyInternalExports` (#6166) by @sapphi-red
- useless __export helper usage (#6160) by @IWANABETHATGUY
- incremental watch modify entry module (#6156) by @IWANABETHATGUY
- register trace subscriber (#6145) by @sapphi-red
- json imports error with `eval` or `arguments` in *strict mode* (#6140) by @IWANABETHATGUY
- `process` is not defined in repl (#6147) by @IWANABETHATGUY

### 💼 Other

- rolldown: support to build `rolldown` with `.wasm` binding (#6153) by @hyf0
- rolldown: refactor `build.ts` to prepare to support build `rolldown` package with wasi binding (#6152) by @hyf0

### 🚜 Refactor

- share `FlatOptions` in whole build session (#6211) by @IWANABETHATGUY
- remove unnecessary `comments` in ScopeHoistingFinalizerContext (#6205) by @IWANABETHATGUY
- move external string/regex matching from JS to Rust (#6201) by @shulaoda
- rename `cross_module_inline_const` to `cross_module_optimization` (#6193) by @IWANABETHATGUY
- rename `class` and `function` visitor to `class_decl`, `function_decl` (#6176) by @IWANABETHATGUY
- rolldown_error: tweak code (#6168) by @shulaoda
- improve `BuildDiagnostic` (#6165) by @shulaoda
- improve `RolldownBuild` (#6136) by @shulaoda
- rolldown_error: remove unused `EventKind::IoError` (#6134) by @shulaoda
- rename CustomPathsMut to NotifyPathsMutAdapter and move to utils (#6135) by @hyf0

### 📚 Documentation

- contrib-guide: add profiling instructions for macOS (#6183) by @sapphi-red
- contrib-guide: update just commands (#6181) by @sapphi-red

### ⚡ Performance

- pre calculate `side_effects_free_function_symbol_ref` (#6206) by @IWANABETHATGUY
- parallel clone ast (#6167) by @IWANABETHATGUY
- reserve capacity for rendered modules in `instantiate_chunk` (#6159) by @sapphi-red

### 🧪 Testing

- hmr: ensure each test isolated to be able to be retryed (#6142) by @hyf0

### ⚙️ Miscellaneous Tasks

- deps: lock file maintenance npm packages (#6219) by @renovate[bot]
- deps: lock file maintenance rust crates (#6217) by @renovate[bot]
- deps: update github-actions (#6213) by @renovate[bot]
- deps: lock file maintenance npm packages (#6215) by @renovate[bot]
- deps: update github-actions (major) (#6214) by @renovate[bot]
- tweak wordings (#6208) by @iiio2
- fix unused import warnings (#6196) by @shulaoda
- correct deprecated JSDoc reference for jsx option (#6195) by @shulaoda
- add `if: always()` to wasi-test (#6190) by @sapphi-red
- skip `@rolldown/browser` build if no node related changes detected (#6189) by @sapphi-red
- extract wasi build to reusable workflow (#6188) by @sapphi-red
- deps: update dependency tsdown to v0.15.1 (#6184) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.16.5 (#6182) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.16.4 (#6180) by @renovate[bot]
- dev: implement Debug trait for DevOptions (#6173) by @sapphi-red
- deps: update dependency rolldown-plugin-dts to v0.16.3 (#6172) by @renovate[bot]
- update @napi-rs/cli and js binding (#6157) by @Brooooooklyn
- ci: ensure `@rolldown/browser` build without errors (#6155) by @hyf0
- ci: ensure running wasi tests correctly (#6154) by @hyf0
- add more tracing instrumentation (#6149) by @sapphi-red
- extend timeout for rollup test (#6143) by @IWANABETHATGUY
- rolldown_error: remove unnecessary `type_aliases.rs` (#6133) by @shulaoda
graphite-app bot pushed a commit that referenced this pull request Sep 16, 2025
…ase` option (#6226)

`runtime_resolve_base` option is not used and probably won't be used in the future as #6177 landed.
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.

Improve oxc runtime resolution

4 participants