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

Bugfix allow re-export of existing named members #698

Merged
merged 1 commit into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/HelperManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const HELPERS: {[name: string]: string} = {
`,
createNamedExportFrom: `
function createNamedExportFrom(obj, localName, importedName) {
Object.defineProperty(exports, localName, {enumerable: true, get: () => obj[importedName]});
Object.defineProperty(exports, localName, {enumerable: true, configurable: true, get: () => obj[importedName]});
}
`,
// Note that TypeScript and Babel do this differently; TypeScript does a simple existence
Expand All @@ -41,7 +41,7 @@ const HELPERS: {[name: string]: string} = {
if (exports.hasOwnProperty(key)) {
return;
}
Object.defineProperty(exports, key, {enumerable: true, get: () => obj[key]});
Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]});
});
}
`,
Expand Down
4 changes: 2 additions & 2 deletions test/prefixes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; }
newObj.default = obj; return newObj; } }`;
export const CREATE_NAMED_EXPORT_FROM_PREFIX = ` function _createNamedExportFrom(obj, \
localName, importedName) { Object.defineProperty(exports, localName, \
{enumerable: true, get: () => obj[importedName]}); }`;
{enumerable: true, configurable: true, get: () => obj[importedName]}); }`;
export const CREATE_STAR_EXPORT_PREFIX = ` function _createStarExport(obj) { \
Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") \
.forEach((key) => { if (exports.hasOwnProperty(key)) { return; } \
Object.defineProperty(exports, key, {enumerable: true, get: () => obj[key]}); }); }`;
Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }`;
export const ESMODULE_PREFIX = 'Object.defineProperty(exports, "__esModule", {value: true});';
export const RHL_PREFIX = `(function () { \
var enterModule = require('react-hot-loader').enterModule; enterModule && enterModule(module); \
Expand Down