diff --git a/code/lib/codemod/src/transforms/__tests__/mdx-to-csf.test.ts b/code/lib/codemod/src/transforms/__tests__/mdx-to-csf.test.ts
index 669a836e65ea..f26c475d9fa8 100644
--- a/code/lib/codemod/src/transforms/__tests__/mdx-to-csf.test.ts
+++ b/code/lib/codemod/src/transforms/__tests__/mdx-to-csf.test.ts
@@ -473,6 +473,42 @@ test('story name equals component name', () => {
`);
});
+test('story name equals component name for vue', () => {
+ const input = dedent`
+ import { Meta, Story } from '@storybook/addon-docs';
+ import Button from './Button.vue';
+
+
+
+
+ `;
+
+ const mdx = jscodeshift({ source: input, path: 'Foobar.stories.mdx' });
+ const [, csf] = fs.writeFileSync.mock.calls[0];
+
+ expect(mdx).toMatchInlineSnapshot(`
+ import { Meta, Story } from '@storybook/blocks';
+ import * as FoobarStories from './Foobar.stories';
+
+
+
+
+
+ `);
+ expect(csf).toMatchInlineSnapshot(`
+ import Button from './Button.vue';
+
+ export default {
+ title: 'Button',
+ };
+
+ export const Button_ = {
+ render: () => ,
+ };
+
+ `);
+});
+
test('kebab case file name', () => {
const input = dedent`
import { Meta, Story } from '@storybook/addon-docs';
diff --git a/code/lib/codemod/src/transforms/mdx-to-csf.ts b/code/lib/codemod/src/transforms/mdx-to-csf.ts
index 06cb563bd333..77aabc19350c 100644
--- a/code/lib/codemod/src/transforms/mdx-to-csf.ts
+++ b/code/lib/codemod/src/transforms/mdx-to-csf.ts
@@ -253,7 +253,7 @@ export function transform(source: string, baseName: string): [mdx: string, csf:
},
ImportDeclaration: (path) => {
path.node.specifiers.forEach((specifier) => {
- if (specifier.type === 'ImportSpecifier' && specifier.local.name === name) {
+ if (specifier.local.name === name) {
found = true;
}
});