Skip to content
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

Merged
merged 4 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: use cjs-module-lexer friendly syntax
  • Loading branch information
magic-akari authored and nicolo-ribaudo committed Oct 13, 2023
commit 384c8617995d7a801618f577b57e836d478db0ec
2 changes: 1 addition & 1 deletion packages/babel-helper-module-transforms/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ function buildExportInitializationStatements(
const InitTemplate = {
computed: template.expression`EXPORTS["NAME"] = VALUE`,
default: template.expression`EXPORTS.NAME = VALUE`,
define: template.expression`Object.defineProperty(EXPORTS, "NAME", { enumerable:true, writable: true, value: void 0 })["NAME"] = VALUE`,
define: template.expression`Object.defineProperty(EXPORTS, "NAME", { enumerable:true, value: void 0, writable: true })["NAME"] = VALUE`,
};

function buildInitStatement(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ define(["exports", "./input.js"], function (_exports, _input) {
});
_exports.a = Object.defineProperty(_exports, "__proto__", {
enumerable: true,
writable: true,
value: void 0
value: void 0,
writable: true
})["__proto__"] = _exports._ = void 0;
const __proto__ = _exports.__proto__ = null;
const a = _exports.a = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
});
exports.a = Object.defineProperty(exports, "__proto__", {
enumerable: true,
writable: true,
value: void 0
value: void 0,
writable: true
})["__proto__"] = exports._ = void 0;
var _input = require("./input.js");
const __proto__ = exports.__proto__ = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
});
_exports.a = Object.defineProperty(_exports, "__proto__", {
enumerable: true,
writable: true,
value: void 0
value: void 0,
writable: true
})["__proto__"] = _exports._ = void 0;
const __proto__ = _exports.__proto__ = null;
const a = _exports.a = 1;
Expand Down