Commit aab9cc1
Kai Gritun
fix(commonjs): handle global shorthand property correctly
When `global` is used as a shorthand property in an object literal (e.g.,
`{global}`), the plugin was replacing `global` with
`commonjsHelpers.commonjsGlobal`, resulting in invalid syntax
`{commonjsHelpers.commonjsGlobal}`.
This fix follows the same pattern used for the `require` shorthand case:
when detecting a shorthand property, prepend `global: ` to convert it to a
full property before replacing the value.
Fixes rollup/rollup#62421 parent c8e78c8 commit aab9cc1
File tree
3 files changed
+16
-0
lines changed- packages/commonjs
- src
- test/fixtures/function/shorthand-global
3 files changed
+16
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
325 | 331 | | |
326 | 332 | | |
327 | 333 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
0 commit comments