Describe the bug
Import statements are hoisted when target is CommonJS:
import A from "a;
console.log(1);
import B from "a";
Becomes
require(...);
require(...);
console.log(1);
This is incorrect, require calls are normal functions and should have preserved order. Imports should only be hoisted when they are actual es6 imports. This is incompatible with tsc and probably others, tsc keeps the order as expected when output module is commonjs.
Additional context
It was fixed but then reverted in #1457
Describe the bug
Import statements are hoisted when target is CommonJS:
Becomes
This is incorrect, require calls are normal functions and should have preserved order. Imports should only be hoisted when they are actual es6 imports. This is incompatible with tsc and probably others, tsc keeps the order as expected when output module is commonjs.
Additional context
It was fixed but then reverted in #1457