es transform cjs error result
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 26.3k
- Forks
- 1.8k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 20
Description
Rollup Version
3.2.37
Operating System (or Browser)
window
Node Version (if applicable)
16.15.1
Link To Reproduction
Expected Behaviour
expect to be console.log(test['default'],test.a,123) or console.log(test.default,test,a,123)
Actual Behaviour
`
// index.ts
import test,{a} from './abc'
console.log(test,a,123)
export default test
export {a}
// abc.ts
const a = 123
const test = {}
export default test
export {a}
`
------------------------>
`
// index.js
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var test = require('./abc');
console.log(test,test.a,123); // error log
Object.defineProperty(exports, 'a', {
enumerable: true,
get: function () { return test.a; }
});
exports.default = test;
// abc. js
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const a = 123;
const test = {};
exports.a = a;
exports.default = test;
`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Rollup REPL reproduction and compare the ES-to-CommonJS output for the default and named imports. Trace the output-generation entry point responsible for this transformation; done means the generated CommonJS code matches the expected console.log behavior without changing the other exports.
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
- 38/100