-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: handle __proto__
exports name in CJS/AMD/UMD
#16015
Conversation
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 |
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
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 0 run 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)); |
I will update the template. Object.defineProperty(exports, "__proto__", {
enumerable: true,
value: void 0,
writable: true
})["__proto__"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!