Ensure that the wildcard interop is used with re-export + default. (#8316)
This commit is contained in:
6
packages/babel-plugin-transform-modules-commonjs/test/fixtures/interop/export-all/input.js
vendored
Normal file
6
packages/babel-plugin-transform-modules-commonjs/test/fixtures/interop/export-all/input.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
// The fact that this exports both a normal default, and all of the names via
|
||||
// re-export is an edge case that is important not to miss. See
|
||||
// https://github.com/babel/babel/issues/8306 as an example.
|
||||
import _default from 'react';
|
||||
export default _default;
|
||||
export * from 'react';
|
||||
25
packages/babel-plugin-transform-modules-commonjs/test/fixtures/interop/export-all/output.js
vendored
Normal file
25
packages/babel-plugin-transform-modules-commonjs/test/fixtures/interop/export-all/output.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _exportNames = {};
|
||||
exports.default = void 0;
|
||||
|
||||
var _react = babelHelpers.interopRequireWildcard(require("react"));
|
||||
|
||||
Object.keys(_react).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _react[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
// The fact that this exports both a normal default, and all of the names via
|
||||
// re-export is an edge case that is important not to miss. See
|
||||
// https://github.com/babel/babel/issues/8306 as an example.
|
||||
var _default2 = _react.default;
|
||||
exports.default = _default2;
|
||||
Reference in New Issue
Block a user