fix: handle __proto__ exports name in CJS/AMD/UMD#16015
Merged
nicolo-ribaudo merged 4 commits intobabel:mainfrom Oct 13, 2023
magic-akari:fix/issue-16014
Merged
fix: handle __proto__ exports name in CJS/AMD/UMD#16015nicolo-ribaudo merged 4 commits intobabel:mainfrom magic-akari:fix/issue-16014
__proto__ exports name in CJS/AMD/UMD#16015nicolo-ribaudo merged 4 commits intobabel:mainfrom
magic-akari:fix/issue-16014
Conversation
Contributor
magic-akari
commented
Oct 1, 2023
| Q | A |
|---|---|
| Fixed Issues? | Fixes #16014 |
| Patch: Bug Fix? | 👍 |
| Major: Breaking Change? | |
| Minor: New Feature? | |
| Tests Added + Pass? | Yes |
| Documentation PR Link | |
| Any Dependency Changes? | |
| License | MIT |
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/55663/ |
__proto__ exports name in CommonJS__proto__ exports name in CJS/AMD/UMD
JLHwung
approved these changes
Oct 2, 2023
Member
|
This doesn't seem to be detected as an ESM-available named export in nodejs. 🤦♂️ Object.defineProperty(exports, "__proto__", {
enumerable: true,
value: void 0
})Object.defineProperty(exports, "__proto__", {
value: void 0
})exports.__proto__ = void 0run in browser const { init, parse } = await import(
"https://cdn.skypack.dev/cjs-module-lexer"
);
await init();
const code = `
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.a = Object.defineProperty(exports, "__proto__", {
enumerable: true,
writable: true,
value: void 0
})["__proto__"] = exports._ = void 0;
var _input = require("./input.js");
const __proto__ = exports.__proto__ = null;
const a = exports.a = 1;
const _ = exports._ = 2;
console.log(_input.__proto__);
`;
console.log(parse(code)); |
Contributor
Author
|
I will update the template. Object.defineProperty(exports, "__proto__", {
enumerable: true,
value: void 0,
writable: true
})["__proto__"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.