@@ -57,8 +57,8 @@ if (true) {
5757`
5858 expect ( await testTransform ( input ) ) . toMatchInlineSnapshot ( `
5959 "const exports = {}; const module = { exports };
60- const __cjs_to_esm_hoist_1 = await import("react-dom");
6160 const __cjs_to_esm_hoist_0 = await import("react");
61+ const __cjs_to_esm_hoist_1 = await import("react-dom");
6262 "production" !== process.env.NODE_ENV && (function() {
6363 var React = __cjs_to_esm_hoist_0;
6464 var ReactDOM = __cjs_to_esm_hoist_1;
@@ -68,6 +68,36 @@ if (true) {
6868 ` )
6969 } )
7070
71+ it ( 'edge cases' , async ( ) => {
72+ const input = `\
73+ const x1 = require("te" + "st");
74+ const x2 = require("test")().test;
75+ console.log(require("test"))
76+
77+ function test() {
78+ const y1 = require("te" + "st");
79+ const y2 = require("test")().test;
80+ consoe.log(require("test"))
81+ }
82+ `
83+ expect ( await testTransform ( input ) ) . toMatchInlineSnapshot ( `
84+ "const exports = {}; const module = { exports };
85+ const __cjs_to_esm_hoist_0 = await import("te" + "st");
86+ const __cjs_to_esm_hoist_1 = await import("test");
87+ const __cjs_to_esm_hoist_2 = await import("test");
88+ const x1 = (await import("te" + "st"));
89+ const x2 = (await import("test"))().test;
90+ console.log((await import("test")))
91+
92+ function test() {
93+ const y1 = __cjs_to_esm_hoist_0;
94+ const y2 = __cjs_to_esm_hoist_1().test;
95+ consoe.log(__cjs_to_esm_hoist_2)
96+ }
97+ "
98+ ` )
99+ } )
100+
71101 it ( 'local require' , async ( ) => {
72102 const input = `\
73103{
0 commit comments