File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
packages/plugin-rsc/src/transforms Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,32 @@ if (true) {
6868 ` )
6969 } )
7070
71+ it ( 'edge cases' , async ( ) => {
72+ const input = `\
73+ const x = require("te" + "st");
74+
75+ function test() {
76+ const y = require("te" + "st");
77+ }
78+
79+ require("test")();
80+ require("test").test;
81+ `
82+ expect ( await testTransform ( input ) ) . toMatchInlineSnapshot ( `
83+ "const exports = {}; const module = { exports };
84+ const __cjs_to_esm_hoist_0 = await import("te" + "st");
85+ const x = (await import("te" + "st"));
86+
87+ function test() {
88+ const y = __cjs_to_esm_hoist_0;
89+ }
90+
91+ (await import("test"))();
92+ (await import("test")).test;
93+ "
94+ ` )
95+ } )
96+
7197 it ( 'local require' , async ( ) => {
7298 const input = `\
7399{
You can’t perform that action at this time.
0 commit comments