Skip to content

Commit

Permalink
Merge pull request #26303 from storybookjs/fix/26179-vue-component-me…
Browse files Browse the repository at this point in the history
…ta-reference

Vue: Fix reference error when using re-exports with "vue-component-meta"
  • Loading branch information
kasperpeulen committed Mar 6, 2024
2 parents b314219 + 9e01244 commit 489eba2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion code/frameworks/vue3-vite/src/plugins/vue-component-meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ export async function vueComponentMeta(): Promise<PluginOption> {
// we can only add the "__docgenInfo" to variables that are actually defined in the current file
// so e.g. re-exports like "export { default as MyComponent } from './MyComponent.vue'" must be ignored
// to prevent runtime errors
if (new RegExp(`export {.*${name}.*}`).test(src)) {
if (
new RegExp(`export {.*${name}.*}`).test(src) ||
new RegExp(`export \\* from ['"]\\S*${name}['"]`).test(src) ||
// when using re-exports, some exports might be resolved via checker.getExportNames
// but are not directly exported inside the current file so we need to ignore them too
!src.includes(name)
) {
return;
}

Expand Down

0 comments on commit 489eba2

Please sign in to comment.