Skip to content
Permalink
Browse files

Fix lazy option of babel-plugin-transform-modules-commonjs (#9802)

* Fix lazy mode of babel-plugin-transform-modules-commonjs (#9447)

* Update output snapshots for lazy mode of babel-plugin-transform-modules-commonjs (#9447)
  • Loading branch information...
AndreasCag authored and nicolo-ribaudo committed Apr 1, 2019
1 parent 3c11a4a commit 123fdfd314912570cf251b13a976463bdb1ca0e8
@@ -288,7 +288,7 @@ function getModuleMetadata(
// dependency modules are loaded lazily.
metadata.lazy = !/\./.test(source);
} else if (Array.isArray(lazy)) {
metadata.lazy = lazy.indexOf(source);
metadata.lazy = lazy.indexOf(source) !== -1;
} else if (typeof lazy === "function") {
metadata.lazy = lazy(source);
} else {
@@ -1,16 +1,16 @@
"use strict";

var _white = babelHelpers.interopRequireDefault(require("white"));
function _white() {
const data = babelHelpers.interopRequireDefault(require("white"));

function _black() {
const data = babelHelpers.interopRequireDefault(require("black"));

_black = function () {
_white = function () {
return data;
};

return data;
}

console.log(_white.default);
console.log(_black().default);
var _black = babelHelpers.interopRequireDefault(require("black"));

console.log(_white().default);
console.log(_black.default);
@@ -1,16 +1,16 @@
"use strict";

var _white = require("white");
function _white() {
const data = require("white");

function _black() {
const data = require("black");

_black = function () {
_white = function () {
return data;
};

return data;
}

console.log(_white.foo1);
console.log(_black().foo2);
var _black = require("black");

console.log(_white().foo1);
console.log(_black.foo2);
@@ -1,16 +1,15 @@
"use strict";

var foo1 = babelHelpers.interopRequireDefault(require("white"));
function foo1() {
const data = babelHelpers.interopRequireDefault(require("white"));

function foo2() {
const data = babelHelpers.interopRequireDefault(require("black"));

foo2 = function () {
foo1 = function () {
return data;
};

return data;
}

console.log(foo1);
console.log(foo2());
var foo2 = babelHelpers.interopRequireDefault(require("black"));
console.log(foo1());
console.log(foo2);
@@ -6,8 +6,16 @@ Object.defineProperty(exports, "__esModule", {
Object.defineProperty(exports, "default", {
enumerable: true,
get: function () {
return _white.default;
return _white().default;
}
});

var _white = babelHelpers.interopRequireDefault(require("white"));
function _white() {
const data = babelHelpers.interopRequireDefault(require("white"));

_white = function () {
return data;
};

return data;
}
@@ -6,24 +6,24 @@ Object.defineProperty(exports, "__esModule", {
Object.defineProperty(exports, "named1", {
enumerable: true,
get: function () {
return _white.named1;
return _white().named1;
}
});
Object.defineProperty(exports, "named2", {
enumerable: true,
get: function () {
return _black().named2;
return _black.named2;
}
});

var _white = require("white");
function _white() {
const data = require("white");

function _black() {
const data = require("black");

_black = function () {
_white = function () {
return data;
};

return data;
}

var _black = require("black");
@@ -4,22 +4,22 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.namespace2 = exports.namespace1 = void 0;
var namespace1 = babelHelpers.interopRequireDefault(require("white"));
exports.namespace1 = namespace1;

function namespace2() {
const data = babelHelpers.interopRequireDefault(require("black"));
function namespace1() {
const data = babelHelpers.interopRequireDefault(require("white"));

namespace2 = function () {
namespace1 = function () {
return data;
};

return data;
}

Object.defineProperty(exports, "namespace2", {
Object.defineProperty(exports, "namespace1", {
enumerable: true,
get: function () {
return namespace2();
return namespace1();
}
});
var namespace2 = babelHelpers.interopRequireDefault(require("black"));
exports.namespace2 = namespace2;

0 comments on commit 123fdfd

Please sign in to comment.
You can’t perform that action at this time.