rollup / rollup/rollup

Live bindings for multiple exports do not update correctly on cjs.

Open
#5,175 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

t¹ 🐞 bug t⁸ ⋅ triage
Dominant language
JavaScript
Stars
26.3k
Forks
1.8k
Avg merge
2d 11h
Merged PRs (30d)
20

Description

Rollup Version

4.0.0

Operating System (or Browser)

Browser

Node Version (if applicable)

No response

Link To Reproduction

https://rollupjs.org/repl/?version=4.0.0&shareable=JTdCJTIyZXhhbXBsZSUyMiUzQW51bGwlMkMlMjJtb2R1bGVzJTIyJTNBJTVCJTdCJTIyY29kZSUyMiUzQSUyMmxldCUyMGElMjAlM0QlMjAzJTNCJTVDbmV4cG9ydCUyMCU3QmElMkMlMjBhJTIwYXMlMjBiJTdEJTVDbiU1Q25leHBvcnQlMjBmdW5jdGlvbiUyMHNldCgpJTIwJTdCJTVDbiUyMCUyMGElMjAlM0QlMjA0JTNCJTVDbiU3RCUyMiUyQyUyMmlzRW50cnklMjIlM0F0cnVlJTJDJTIybmFtZSUyMiUzQSUyMm1haW4uanMlMjIlN0QlNUQlMkMlMjJvcHRpb25zJTIyJTNBJTdCJTIyb3V0cHV0JTIyJTNBJTdCJTIyZm9ybWF0JTIyJTNBJTIyY2pzJTIyJTdEJTJDJTIydHJlZXNoYWtlJTIyJTNBdHJ1ZSU3RCU3RA==

Expected Behaviour
// input.js
let a = 3;
export {a, a as b}

export function set() {
  a = 4;
}


// output.cjs
'use strict';

exports.a = exports.b = 3;

function set() {
  exports.a = exports.b = 4;
}

exports.set = set;
Actual Behaviour
// input.js
let a = 3;
export {a, a as b}

export function set() {
  a = 4;
}

// output.cjs
'use strict';

exports.b = 3;

function set() {
  exports.b = 4;
}

exports.a = exports.b;
exports.set = set;

exports.a does not updated on a reassigned.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Rollup REPL reproduction and compare the shown input.js and output.cjs for the CommonJS output. Trace how the two exports of the same binding are generated, then verify that reassigning a updates both exports and that the output matches the expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.