💻
How are you using Babel?
Programmatic API (babel.transform, babel.parse)
Input code
import * as a from "mod";
import * as b from "mod";
later(() => [a, b])
Configuration file name
No response
Configuration
const out = transformSync(input, {
configFile: false,
plugins: [[await load(`transform-modules-commonjs`), { lazy: true }]],
});
Current and expected behavior
Current:
"use strict";
function a() {
const data = _interopRequireWildcard(require("mod"));
a = function () {
return data;
};
return data;
}
var b = a();
function _getRequireWildcardCache(nodeInterop) { ... }
later(() => [a(), b()]);
Expected (note the b declaration):
"use strict";
function a() {
const data = _interopRequireWildcard(require("mod"));
a = function () {
return data;
};
return data;
}
var b = a;
function _getRequireWildcardCache(nodeInterop) { ... }
later(() => [a(), b()]);
Environment
Current main
Possible solution
No response
Additional context
No response
💻
How are you using Babel?
Programmatic API (
babel.transform,babel.parse)Input code
Configuration file name
No response
Configuration
Current and expected behavior
Current:
Expected (note the
bdeclaration):Environment
Current main
Possible solution
No response
Additional context
No response