fix(npm): handle cjs re-exports with the same name as an export (#15626)

This commit is contained in:
David Sherret 2022-08-26 14:34:35 -04:00 committed by GitHub
parent 9b324b1cf4
commit ec98d86d21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 59 additions and 8 deletions

View file

@ -0,0 +1,19 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
// collision will occur with __esModule in other_file.js
Object.defineProperty(exports, "__esModule", { value: true });
const other_file_1 = __importDefault(require("./other_file"));
__exportStar(require("./other_file"), exports);
exports.default = other_file_1.default;

View file

@ -0,0 +1,10 @@
"use strict";
class Hello {
sayHello() {
console.log("Hi.");
}
}
// conflict will be with __esModule
Object.defineProperty(exports, "__esModule", { value: true });
exports.hello = new Hello();
exports.default = new Hello();

View file

@ -0,0 +1,5 @@
{
"name": "@denotest/cjs-reexport-collision",
"version": "1.0.0",
"main": "./index.js"
}