Skip to content

Commit 0d205e6

Browse files
fix: proper name exports
1 parent 559fabd commit 0d205e6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ export function transformCompiledCode(code: string, outputPath: string) {
247247
/**
248248
* this assumes that the first named import is the component name
249249
*/
250-
const componentName = Object.values(componentImport?.namedImports || {})[0]
251-
if (componentImport) {
252-
code += `\nexport { ${componentName} } from '${path.posix.resolve(outputDir, componentImport.specifier)}';\n`
250+
const namedImport = Object.entries(componentImport?.namedImports || {})[0]
251+
if (namedImport && componentImport) {
252+
code += `\nexport { ${namedImport.join(' as ')} } from '${path.posix.resolve(outputDir, componentImport.specifier)}';\n`
253253
}
254254
}
255255

test/utils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ describe('transformCompiledCode', () => {
110110
111111
export { defineCustomElement, IonButton }
112112
113-
export { Button } from '/foo/bar/loo/components/button.js';
113+
export { B as Button } from '/foo/bar/loo/components/button.js';
114114
"
115115
`)
116116
})

0 commit comments

Comments
 (0)