Skip to content

Comments

feat: take node esm spec into account for dynamic imports in cjs modules that satisfy nodejs#4819

Merged
hyf0 merged 1 commit intomainfrom
06-04-feat_always_take_node_esm_spec_into_account_for_dynamic_imports_in_cjs_modules
Jun 4, 2025
Merged

feat: take node esm spec into account for dynamic imports in cjs modules that satisfy nodejs#4819
hyf0 merged 1 commit intomainfrom
06-04-feat_always_take_node_esm_spec_into_account_for_dynamic_imports_in_cjs_modules

Conversation

@hyf0
Copy link
Member

@hyf0 hyf0 commented Jun 4, 2025

Description

Related to #4289.

@sapphi-red pointed out that dynamic imports in cjs is a thing that's quite specfic to nodejs. So to improve compatibilities of import('some-cjs-module.js'), now rolldown always considers node esm spec for dynamic imports in cjs modules.

@hyf0 hyf0 marked this pull request as ready for review June 4, 2025 10:51
@hyf0 hyf0 force-pushed the 06-04-feat_always_take_node_esm_spec_into_account_for_dynamic_imports_in_cjs_modules branch from 4e9a9f1 to 5bfb879 Compare June 4, 2025 11:01
@github-actions
Copy link
Contributor

github-actions bot commented Jun 4, 2025

Benchmarks Rust

  • target: main(4cdaabd)
  • pr: 06-04-feat_always_take_node_esm_spec_into_account_for_dynamic_imports_in_cjs_modules(13b1f3a)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.00     77.3±1.60ms        ? ?/sec    1.02     78.6±2.18ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.00     88.0±1.27ms        ? ?/sec    1.02     90.1±2.29ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00    114.6±1.85ms        ? ?/sec    1.01    115.5±1.63ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.00    129.2±1.22ms        ? ?/sec    1.01    130.2±1.75ms        ? ?/sec
bundle/bundle@threejs                                        1.01     42.0±2.54ms        ? ?/sec    1.00     41.7±2.07ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.01     48.0±1.10ms        ? ?/sec    1.00     47.6±1.05ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    440.4±3.81ms        ? ?/sec    1.01   446.1±18.82ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    513.0±2.12ms        ? ?/sec    1.00    514.6±3.74ms        ? ?/sec
scan/scan@rome_ts                                            1.00     91.0±1.25ms        ? ?/sec    1.00     90.7±1.15ms        ? ?/sec
scan/scan@threejs                                            1.00     31.8±0.76ms        ? ?/sec    1.01     32.1±2.07ms        ? ?/sec
scan/scan@threejs10x                                         1.00    328.5±3.89ms        ? ?/sec    1.00    327.9±4.63ms        ? ?/sec

@hyf0 hyf0 force-pushed the 06-04-feat_always_take_node_esm_spec_into_account_for_dynamic_imports_in_cjs_modules branch from 5bfb879 to 61a4508 Compare June 4, 2025 12:00
@hyf0 hyf0 force-pushed the 06-04-test_ensure_correct_and_consistent_behavior_on_handling_import_._some-cjs-module.js_ branch 2 times, most recently from e2e3b49 to 929f3da Compare June 4, 2025 12:05
@hyf0 hyf0 force-pushed the 06-04-feat_always_take_node_esm_spec_into_account_for_dynamic_imports_in_cjs_modules branch from 61a4508 to 246d83e Compare June 4, 2025 12:05
@hyf0 hyf0 force-pushed the 06-04-test_ensure_correct_and_consistent_behavior_on_handling_import_._some-cjs-module.js_ branch from 929f3da to f11a80f Compare June 4, 2025 12:24
Base automatically changed from 06-04-test_ensure_correct_and_consistent_behavior_on_handling_import_._some-cjs-module.js_ to main June 4, 2025 12:41
@hyf0 hyf0 force-pushed the 06-04-feat_always_take_node_esm_spec_into_account_for_dynamic_imports_in_cjs_modules branch from 246d83e to ef0b17b Compare June 4, 2025 12:42
@netlify
Copy link

netlify bot commented Jun 4, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 13b1f3a
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/684041bd8a2f460009afbdd8

@graphite-app
Copy link
Contributor

graphite-app bot commented Jun 4, 2025

Merge activity

  • Jun 4, 12:42 PM UTC: Graphite rebased this pull request, because this pull request is set to merge when ready.

@hyf0 hyf0 force-pushed the 06-04-feat_always_take_node_esm_spec_into_account_for_dynamic_imports_in_cjs_modules branch from ef0b17b to 727b536 Compare June 4, 2025 12:48
@hyf0 hyf0 force-pushed the 06-04-feat_always_take_node_esm_spec_into_account_for_dynamic_imports_in_cjs_modules branch from 727b536 to 13b1f3a Compare June 4, 2025 12:53
@hyf0 hyf0 changed the title feat: always take node esm spec into account for dynamic imports in cjs modules feat: take node esm spec into account for dynamic imports in cjs modules that satisfy nodejs Jun 4, 2025
@hyf0 hyf0 requested a review from sapphi-red June 4, 2025 13:27
@hyf0 hyf0 added this pull request to the merge queue Jun 4, 2025
Merged via the queue into main with commit 640af3a Jun 4, 2025
24 checks passed
@hyf0 hyf0 deleted the 06-04-feat_always_take_node_esm_spec_into_account_for_dynamic_imports_in_cjs_modules branch June 4, 2025 13:41
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.

2 participants