Skip to content

Commit f344c63

Browse files
committed
Merge branch 'master' of https://github.com/rollup/rollup into sync-a6be82b8
2 parents f82e577 + a6be82b commit f344c63

6 files changed

Lines changed: 78 additions & 31 deletions

File tree

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
# rollup changelog
22

3+
## 4.60.2
4+
5+
_2026-04-18_
6+
7+
### Bug Fixes
8+
9+
- Resolve a variable rendering bug when generating different formats from the same build (#6350)
10+
11+
### Pull Requests
12+
13+
- [#6327](https://github.com/rollup/rollup/pull/6327): docs: fix various typos in source and documentation (@Abhi3975, @lukastaegert)
14+
- [#6331](https://github.com/rollup/rollup/pull/6331): fix(deps): update minor/patch updates (@renovate[bot])
15+
- [#6332](https://github.com/rollup/rollup/pull/6332): chore(deps): update codecov/codecov-action action to v6 (@renovate[bot])
16+
- [#6333](https://github.com/rollup/rollup/pull/6333): chore(deps): update dependency eslint-plugin-unicorn to v64 (@renovate[bot])
17+
- [#6334](https://github.com/rollup/rollup/pull/6334): fix(deps): update rust crate swc_compiler_base to v51 (@renovate[bot])
18+
- [#6335](https://github.com/rollup/rollup/pull/6335): chore(deps): lock file maintenance (@renovate[bot], @lukastaegert)
19+
- [#6346](https://github.com/rollup/rollup/pull/6346): fix(deps): update minor/patch updates (@renovate[bot])
20+
- [#6347](https://github.com/rollup/rollup/pull/6347): chore(deps): update dependency lru-cache to v11 (@renovate[bot])
21+
- [#6348](https://github.com/rollup/rollup/pull/6348): fix(deps): update swc monorepo (major) (@renovate[bot], @lukastaegert)
22+
- [#6349](https://github.com/rollup/rollup/pull/6349): chore(deps): lock file maintenance (@renovate[bot], @lukastaegert)
23+
- [#6350](https://github.com/rollup/rollup/pull/6350): fix: reset variable render names between outputs in the same generate (@barry3406, @lukastaegert)
24+
- [#6351](https://github.com/rollup/rollup/pull/6351): chore(deps): update minor/patch updates (@renovate[bot])
25+
- [#6352](https://github.com/rollup/rollup/pull/6352): chore(deps): update cross-platform-actions/action action to v1 (@renovate[bot])
26+
- [#6353](https://github.com/rollup/rollup/pull/6353): chore(deps): update dependency lru-cache to v11 (@renovate[bot], @lukastaegert)
27+
- [#6354](https://github.com/rollup/rollup/pull/6354): chore(deps): lock file maintenance (@renovate[bot])
28+
- [#6355](https://github.com/rollup/rollup/pull/6355): chore(deps): lock file maintenance (@renovate[bot])
29+
- [#6356](https://github.com/rollup/rollup/pull/6356): chore(deps): lock file maintenance (@renovate[bot])
30+
- [#6358](https://github.com/rollup/rollup/pull/6358): chore: remove cross-env from devDeps (@K-tecchan)
31+
332
## 4.60.1
433

534
_2026-03-30_

browser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rollup/browser",
3-
"version": "4.60.1",
3+
"version": "4.60.2",
44
"description": "Next-generation ES module bundler browser build",
55
"main": "dist/rollup.browser.js",
66
"module": "dist/es/rollup.browser.js",

package-lock.json

Lines changed: 2 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rollup",
3-
"version": "4.60.1",
3+
"version": "4.60.2",
44
"description": "Next-generation ES module bundler",
55
"main": "dist/rollup.js",
66
"module": "dist/es/rollup.js",
@@ -158,7 +158,6 @@
158158
"chokidar": "^3.6.0",
159159
"concurrently": "^9.2.1",
160160
"core-js": "3.38.1",
161-
"cross-env": "^10.1.0",
162161
"date-time": "^4.0.0",
163162
"es5-shim": "^4.6.7",
164163
"es6-shim": "^0.35.8",

src/Chunk.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,16 @@ export default class Chunk {
14541454
preserveModules,
14551455
externalLiveBindings
14561456
} = this.outputOptions;
1457+
// Reset stale render names from previous output renderings of the same
1458+
// module graph. Without this, variables that were renamed during a prior
1459+
// output's import deconfliction (e.g. given a chunk-prefixed
1460+
// `renderBaseName` like `vendor`) would carry that name into the next
1461+
// output, producing invalid identifiers such as `function vendor.foo()`.
1462+
for (const module of this.orderedModules) {
1463+
for (const variable of module.scope.variables.values()) {
1464+
variable.setRenderNames(null, null);
1465+
}
1466+
}
14571467
const syntheticExports = new Set<SyntheticNamedExportVariable>();
14581468
for (const exportName of this.getExportNames()) {
14591469
const exportVariable = this.exportsByName.get(exportName)!;

test/misc/misc.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,41 @@ describe('misc', () => {
209209
])
210210
));
211211

212+
it('does not leak chunk-prefixed render names from one output into another (#6296)', async () => {
213+
const bundle = await rollup.rollup({
214+
input: 'main',
215+
plugins: [
216+
loader({
217+
main: `import { _ } from 'helper';\nconsole.log(_);`,
218+
helper: `export function _(target, property) { return target[property]; }`
219+
})
220+
]
221+
});
222+
223+
// Generating the chunked CJS first sets `renderBaseName` on the `_`
224+
// variable to the chunk name (`vendor`). Without resetting render names
225+
// at the start of each output, the subsequent UMD generate would emit
226+
// `function vendor._(...)`, which is invalid JavaScript.
227+
const cjs = await bundle.generate({
228+
format: 'cjs',
229+
dir: 'dist',
230+
manualChunks: id => (id === 'helper' ? 'vendor' : undefined)
231+
});
232+
assert.ok(
233+
cjs.output.some(chunk => chunk.fileName.startsWith('vendor')),
234+
'CJS output should contain a vendor chunk'
235+
);
236+
237+
const umd = await bundle.generate({ format: 'umd', name: 'main' });
238+
const umdCode = umd.output[0].code;
239+
assert.ok(
240+
!/function\s+vendor\./.test(umdCode),
241+
`UMD output should not contain a dotted function declaration:\n${umdCode}`
242+
);
243+
// And the function should still parse — eval the wrapper to verify.
244+
assert.doesNotThrow(() => new Function(umdCode), 'UMD output should be valid JavaScript');
245+
});
246+
212247
it('allows passing the same object to `rollup` and `generate`', () => {
213248
const options = {
214249
input: 'input',

0 commit comments

Comments
 (0)