Repository navigation
Commit 76bd619
authored
fix(concatenate-modules): parenthesize a wrapped module's accessor call (#21876)
* fix(concatenate-modules): parenthesize a wrapped module's accessor call
A wrapped CommonJS module is reached through `X_namespaceFn()`, so a
reference standing in for an identifier is a call expression. Without
parentheses `new X_namespaceFn()` applies `new` to the accessor instead of
to the exports it returns, which throws at runtime.
Closes #21873
* test(concatenate-modules): snapshot the emitted bundles instead of pinning substrings
The generated code is what these cases check, so review it as a whole
rather than one matched fragment at a time. Runtime assertions stay.
* test(concatenate-modules): shorten the snapshot plugin comments1 parent fa214ac commit 76bd619
23 files changed
Lines changed: 2093 additions & 6 deletions
File tree
- .changeset
- lib/optimize
- test/configCases/concatenate-modules
- commonjs-wrapped-external-new-expression
- __snapshots__
- commonjs-wrapped-new-expression-output-module
- __snapshots__
- commonjs-wrapped-strict-esm-new-expression
- __snapshots__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| 184 | + | |
184 | 185 | | |
185 | 186 | | |
186 | 187 | | |
| |||
494 | 495 | | |
495 | 496 | | |
496 | 497 | | |
497 | | - | |
| 498 | + | |
| 499 | + | |
498 | 500 | | |
499 | 501 | | |
500 | 502 | | |
| |||
509 | 511 | | |
510 | 512 | | |
511 | 513 | | |
512 | | - | |
| 514 | + | |
| 515 | + | |
513 | 516 | | |
514 | 517 | | |
515 | 518 | | |
| |||
520 | 523 | | |
521 | 524 | | |
522 | 525 | | |
523 | | - | |
| 526 | + | |
| 527 | + | |
524 | 528 | | |
525 | 529 | | |
526 | 530 | | |
| |||
611 | 615 | | |
612 | 616 | | |
613 | 617 | | |
614 | | - | |
| 618 | + | |
| 619 | + | |
615 | 620 | | |
616 | 621 | | |
617 | 622 | | |
| |||
657 | 662 | | |
658 | 663 | | |
659 | 664 | | |
660 | | - | |
| 665 | + | |
| 666 | + | |
661 | 667 | | |
662 | 668 | | |
663 | 669 | | |
| |||
673 | 679 | | |
674 | 680 | | |
675 | 681 | | |
676 | | - | |
| 682 | + | |
| 683 | + | |
677 | 684 | | |
678 | 685 | | |
679 | 686 | | |
| |||
938 | 945 | | |
939 | 946 | | |
940 | 947 | | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
941 | 951 | | |
942 | 952 | | |
943 | 953 | | |
| 954 | + | |
944 | 955 | | |
945 | 956 | | |
946 | 957 | | |
| |||
970 | 981 | | |
971 | 982 | | |
972 | 983 | | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
973 | 988 | | |
974 | 989 | | |
975 | 990 | | |
| |||
0 commit comments