Error: "ReferenceError: c is not defined" when my story imports a component from 'pnpm link' #24032
-
I have the following story: Button.stories.tsx import { Button } from '@incognia/cosmik'
import type { Meta, StoryObj } from '@storybook/react'
import React from 'react'
const meta = {
title: 'Components/Button',
component: Button,
parameters: {
layout: 'centered'
},
tags: ['autodocs']
} satisfies Meta<typeof Button>
export default meta
type Story = StoryObj<typeof meta>
export const Primary: Story = {
args: {
variant: 'primary',
children: 'Button'
}
} OBS: The Then I got this error: ReferenceError: c is not defined
at http://localhost:6006/@fs/Users/gileno.oliveira/Projects/cosmik/dist/index.es.js:11:2 The source code of import { default as r } from "/@fs/Users/gileno.oliveira/Projects/cosmik/dist/index.es2.js";
import { default as e } from "/@fs/Users/gileno.oliveira/Projects/cosmik/dist/index.es3.js";
import { Button as l, buttonVariants as m } from "/@fs/Users/gileno.oliveira/Projects/cosmik/dist/index.es4.js";
export {
l as Button,
r as Colors,
m as buttonVariants,
e as tailwindTheme
};
;c.__docgenInfo={"description":"","methods":[],"displayName":"Button","props":{"asChild":{"defaultValue":{"value":"!1","computed":false},"required":false}}} This is weird because the original source file doesn't have the last line (This is the line with error) OBS: If I change the import to access the Button component via file path, it works fine. Button.stories.tsx
Is there any storybook limitation to access a lib from |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
After a long search, I solved this by setting this vite config: export default defineConfig({
plugins: [react()],
resolve: {
preserveSymlinks: true
}
}) Hope this might help someone. |
Beta Was this translation helpful? Give feedback.
After a long search, I solved this by setting this vite config:
Hope this might help someone.