Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
1 parent
3c11a4a
commit 123fdfd
Showing
7 changed files
with
45 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
...l-plugin-transform-modules-commonjs/test/fixtures/lazy-whitelist/import-default/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
14 changes: 7 additions & 7 deletions
14
...bel-plugin-transform-modules-commonjs/test/fixtures/lazy-whitelist/import-named/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
13 changes: 6 additions & 7 deletions
13
...plugin-transform-modules-commonjs/test/fixtures/lazy-whitelist/import-namespace/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters