@@ -127,6 +127,44 @@ test('export * as from', async () => {
127127 ` )
128128} )
129129
130+ test ( 're-export by imported name' , async ( ) => {
131+ expect (
132+ await ssrTransformSimpleCode ( `\
133+ import * as foo from 'foo'
134+ export * as foo from 'foo'
135+ ` ) ,
136+ ) . toMatchInlineSnapshot ( `
137+ "const __vite_ssr_import_0__ = await __vite_ssr_import__("foo");
138+ const __vite_ssr_import_1__ = await __vite_ssr_import__("foo");
139+ Object.defineProperty(__vite_ssr_exports__, "foo", { enumerable: true, configurable: true, get(){ return __vite_ssr_import_1__ }});
140+ "
141+ ` )
142+
143+ expect (
144+ await ssrTransformSimpleCode ( `\
145+ import { foo } from 'foo'
146+ export { foo } from 'foo'
147+ ` ) ,
148+ ) . toMatchInlineSnapshot ( `
149+ "const __vite_ssr_import_0__ = await __vite_ssr_import__("foo", {"importedNames":["foo"]});
150+ const __vite_ssr_import_1__ = await __vite_ssr_import__("foo", {"importedNames":["foo"]});
151+ Object.defineProperty(__vite_ssr_exports__, "foo", { enumerable: true, configurable: true, get(){ return __vite_ssr_import_1__.foo }});
152+ "
153+ ` )
154+
155+ expect (
156+ await ssrTransformSimpleCode ( `\
157+ import { foo } from 'foo'
158+ export { foo as foo } from 'foo'
159+ ` ) ,
160+ ) . toMatchInlineSnapshot ( `
161+ "const __vite_ssr_import_0__ = await __vite_ssr_import__("foo", {"importedNames":["foo"]});
162+ const __vite_ssr_import_1__ = await __vite_ssr_import__("foo", {"importedNames":["foo"]});
163+ Object.defineProperty(__vite_ssr_exports__, "foo", { enumerable: true, configurable: true, get(){ return __vite_ssr_import_1__.foo }});
164+ "
165+ ` )
166+ } )
167+
130168test ( 'export * as from arbitrary module namespace identifier' , async ( ) => {
131169 expect (
132170 await ssrTransformSimpleCode ( `export * as "arbitrary string" from 'vue'` ) ,
0 commit comments