Avoid re-traversing inserted references to the namespace binding. (#7418)
This commit is contained in:
parent
70627ac92c
commit
62c1046249
@ -202,6 +202,10 @@ const rewriteReferencesVisitor = {
|
||||
}
|
||||
|
||||
requeueInParent(path);
|
||||
|
||||
// The path could have been replaced with an identifier that would
|
||||
// otherwise be re-visited, so we skip processing its children.
|
||||
path.skip();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
5
packages/babel-plugin-transform-modules-commonjs/test/fixtures/regression/lazy-7176/input.js
vendored
Normal file
5
packages/babel-plugin-transform-modules-commonjs/test/fixtures/regression/lazy-7176/input.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import * as mod from "mod";
|
||||
import { named } from "mod";
|
||||
|
||||
named;
|
||||
mod;
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"plugins": [
|
||||
["transform-modules-commonjs", {"lazy": true}],
|
||||
"external-helpers"
|
||||
]
|
||||
}
|
||||
14
packages/babel-plugin-transform-modules-commonjs/test/fixtures/regression/lazy-7176/output.js
vendored
Normal file
14
packages/babel-plugin-transform-modules-commonjs/test/fixtures/regression/lazy-7176/output.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
function mod() {
|
||||
const data = babelHelpers.interopRequireWildcard(require("mod"));
|
||||
|
||||
mod = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
mod().named;
|
||||
mod();
|
||||
Loading…
x
Reference in New Issue
Block a user