Describe the bug
When using vue-component-meta docgen with barrel files that use export * from './...', the plugin generates ReferenceError: <Name> is not defined if an exported component name is a substring of a re-export path.
For example, if a barrel has export * from './Tabs' and the Tabs module exports both Tabs and Tab, the plugin incorrectly appends Tab.__docgenInfo = ... to the barrel file — but Tab is not a local variable there.
Root cause
In the plugin's transform function (@storybook/vue3-vite/dist/preset.js), the check that decides whether to append __docgenInfo uses src.includes(name):
new RegExp(`export {.*${name}.*}`).test(src)
|| new RegExp(`export \\* from ['"]\\S*${name}['"]`).test(src)
|| !src.includes(name)
|| (/* append: name.__docgenInfo = ... */)
src.includes('Tab') matches 'Tab' as a substring inside export * from './Tabs', so the plugin appends Tab.__docgenInfo = ... even though Tab is not a local binding in the barrel.
Reproduction link
https://github.com/mspostolov/storybook-vue-component-meta-barrel-bug
Reproduction steps
git clone https://github.com/mspostolov/storybook-vue-component-meta-barrel-bug.git
cd storybook-vue-component-meta-barrel-bug
npm install
npm run storybook
Open browser console:
ReferenceError: Tab is not defined
at index.ts:4:15
StackBlitz: https://stackblitz.com/github/mspostolov/storybook-vue-component-meta-barrel-bug
Expected behavior
The plugin should not append __docgenInfo for names that are only substring-matched in barrel re-export paths. The src.includes(name) check should use word-boundary matching or verify that the name exists as an actual local binding.
System
Storybook Environment Info:
│
│ System:
│ OS: macOS 15.5
│ CPU: (10) arm64 Apple M1 Pro
│ Shell: 5.9 - /bin/zsh
│ Binaries:
│ Node: 24.13.0
│ npm: 11.6.2
│ active
│ pnpm: 10.28.0
│ Browsers:
│ Chrome: 146.0.7680.178
│ npmPackages:
│ @storybook/addon-docs: ^10.3.0 => 10.3.5
│ @storybook/vue3-vite: ^10.3.0 => 10.3.5
│ storybook: ^10.3.0 => 10.3.5
Additional context
No response
Describe the bug
When using
vue-component-metadocgen with barrel files that useexport * from './...', the plugin generatesReferenceError: <Name> is not definedif an exported component name is a substring of a re-export path.For example, if a barrel has
export * from './Tabs'and theTabsmodule exports bothTabsandTab, the plugin incorrectly appendsTab.__docgenInfo = ...to the barrel file — butTabis not a local variable there.Root cause
In the plugin's
transformfunction (@storybook/vue3-vite/dist/preset.js), the check that decides whether to append__docgenInfousessrc.includes(name):src.includes('Tab')matches'Tab'as a substring insideexport * from './Tabs', so the plugin appendsTab.__docgenInfo = ...even thoughTabis not a local binding in the barrel.Reproduction link
https://github.com/mspostolov/storybook-vue-component-meta-barrel-bug
Reproduction steps
git clone https://github.com/mspostolov/storybook-vue-component-meta-barrel-bug.git cd storybook-vue-component-meta-barrel-bug npm install npm run storybookOpen browser console:
StackBlitz: https://stackblitz.com/github/mspostolov/storybook-vue-component-meta-barrel-bug
Expected behavior
The plugin should not append
__docgenInfofor names that are only substring-matched in barrel re-export paths. Thesrc.includes(name)check should use word-boundary matching or verify that the name exists as an actual local binding.System
Additional context
No response