Skip to content

fix: share commonjs in multi chunks#2087

Closed
IWANABETHATGUY wants to merge 6 commits intomainfrom
fix/cross-chunk-commonjs
Closed

fix: share commonjs in multi chunks#2087
IWANABETHATGUY wants to merge 6 commits intomainfrom
fix/cross-chunk-commonjs

Conversation

@IWANABETHATGUY
Copy link
Copy Markdown
Member

@IWANABETHATGUY IWANABETHATGUY commented Aug 29, 2024

@netlify
Copy link
Copy Markdown

netlify bot commented Aug 29, 2024

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit af52d86
🔍 Latest deploy log https://app.netlify.com/sites/rolldown-rs/deploys/66d18e91b919d6000894ee73

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Aug 29, 2024

Benchmarks Rust

group                                                               pr                                     target
-----                                                               --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol                     1.04     59.5±0.77ms        ? ?/sec    1.00     57.3±2.30ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-minify              1.00     86.9±2.98ms        ? ?/sec    1.00     87.3±2.10ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-minify-sourcemap    1.00    107.4±4.01ms        ? ?/sec    1.00    107.9±2.66ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap           1.03     67.6±0.97ms        ? ?/sec    1.00     65.5±1.43ms        ? ?/sec
bundle/bundle@rome-ts                                               1.00    104.5±1.53ms        ? ?/sec    1.02    106.9±1.44ms        ? ?/sec
bundle/bundle@rome-ts-minify                                        1.00    218.6±2.46ms        ? ?/sec    1.00    219.6±3.34ms        ? ?/sec
bundle/bundle@rome-ts-minify-sourcemap                              1.01    269.1±4.76ms        ? ?/sec    1.00    265.3±4.48ms        ? ?/sec
bundle/bundle@rome-ts-sourcemap                                     1.00    122.3±1.80ms        ? ?/sec    1.01    123.0±1.33ms        ? ?/sec
bundle/bundle@threejs                                               1.00     38.3±0.39ms        ? ?/sec    1.02     39.0±0.26ms        ? ?/sec
bundle/bundle@threejs-minify                                        1.00     85.0±1.30ms        ? ?/sec    1.14     97.1±2.14ms        ? ?/sec
bundle/bundle@threejs-minify-sourcemap                              1.00    106.4±2.74ms        ? ?/sec    1.04    110.3±3.25ms        ? ?/sec
bundle/bundle@threejs-sourcemap                                     1.00     47.0±0.38ms        ? ?/sec    1.05     49.1±0.46ms        ? ?/sec
bundle/bundle@threejs10x                                            1.00    401.3±5.38ms        ? ?/sec    1.04    415.9±5.01ms        ? ?/sec
bundle/bundle@threejs10x-minify                                     1.00  1017.3±11.87ms        ? ?/sec    1.02   1035.3±9.72ms        ? ?/sec
bundle/bundle@threejs10x-minify-sourcemap                           1.00  1284.3±10.02ms        ? ?/sec    1.02  1306.9±10.67ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                                  1.00    476.0±6.49ms        ? ?/sec    1.01    480.1±6.60ms        ? ?/sec
remapping/remapping                                                 1.00     33.1±0.37ms        ? ?/sec    1.03     34.0±0.65ms        ? ?/sec
remapping/render-chunk-remapping                                    1.00     84.2±0.43ms        ? ?/sec    1.00     84.4±0.44ms        ? ?/sec
scan/scan@rome-ts                                                   1.00     85.7±0.80ms        ? ?/sec    1.01     86.2±0.78ms        ? ?/sec
scan/scan@threejs                                                   1.00     30.4±1.37ms        ? ?/sec    1.00     30.5±0.25ms        ? ?/sec
scan/scan@threejs10x                                                1.00    297.8±2.62ms        ? ?/sec    1.02    302.6±3.17ms        ? ?/sec

.map(|(exported_name, export_ref)| {
let canonical_ref = link_output.symbols.par_canonical_ref_for(export_ref);
let symbol = link_output.symbols.get(canonical_ref);
let canonical_name = &chunk.canonical_names[&canonical_ref];
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

should use ns_alias.namesapce_alias_ref when the related symbol has namespace_alias

let canonical_name;
if let Some(ns_alias) = &symbol.namespace_alias {
let canonical_ns_name = &chunk.canonical_names[&ns_alias.namespace_ref];
canonical_name = if export_default_count == 0 {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

if you directly use canonical_name = chunk.canonical_names[&ns_alias.namespace_ref].clone();,
we use issue/2085 as a example, the a~1 would be

## a~1.mjs

```js
import { import_b } from "./a.mjs";

var import_b = import_b._default;
export { import_b as default };

@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review August 30, 2024 14:19
github-merge-queue bot pushed a commit that referenced this pull request Aug 31, 2024
…2094)

<!-- Thank you for contributing! -->

### Description
- Fixes #1722
- Fixes #2085
- Closes #2087

This is yet another problem caused by forgetting sync symbols with other
parts of bundler. I'm planing to refactor these logic, to make symbols
work automatically to prevent problems caused by forgetting.

<!-- Please insert your description here and provide especially info
about the "what" this PR is solving -->

---------

Co-authored-by: IWANABETHATGUY <iwanabethatguy@qq.com>
@IWANABETHATGUY IWANABETHATGUY deleted the fix/cross-chunk-commonjs branch December 27, 2024 06:52
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.

[Bug]: panic in render_chunk_exports

1 participant