@@ -57,8 +57,8 @@ if (true) {
57
57
`
58
58
expect ( await testTransform ( input ) ) . toMatchInlineSnapshot ( `
59
59
"const exports = {}; const module = { exports };
60
- const __cjs_to_esm_hoist_1 = await import("react-dom");
61
60
const __cjs_to_esm_hoist_0 = await import("react");
61
+ const __cjs_to_esm_hoist_1 = await import("react-dom");
62
62
"production" !== process.env.NODE_ENV && (function() {
63
63
var React = __cjs_to_esm_hoist_0;
64
64
var ReactDOM = __cjs_to_esm_hoist_1;
@@ -68,6 +68,36 @@ if (true) {
68
68
` )
69
69
} )
70
70
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
+
71
101
it ( 'local require' , async ( ) => {
72
102
const input = `\
73
103
{
0 commit comments