-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Storybook imports extra unnecessary files #77
Comments
@tmeasday do you know why this might happen? Does webpack have problems tree-shaking due to the glob-to-regex trick that we do? I looked through the |
I'm really unsure about this one too. Here's the contents of
You can see the
|
I just tried something similar in a sandbox. No error if I add import 'something wrong'; The error I got was:
I have Notice the error in the repro says:
I'm not sure why the regexp is missing the include there? I wonder if something in the build process is stripping comments. Notice there's no |
Maybe it's something in When I no-oped that
As further evidence - if I make the
|
Hmm @dannyhw I wonder if the Moving this issue to the |
Documenting here, as it took me ages to get this working on my project, and it might help someone trying just to get the integration off the ground until this gets fixed. My use-case is simple, I want to start adding stories little by little in a very well-established project, full of dependencies. I only have a single import { View } from 'react-native';
import type { Meta, StoryObj } from '@storybook/react';
import { MyButton } from './Button'; (it's the boilerplate example generated by storybook/react-native) Manually importing the stories gets rid of the errors - which seems to indicate the issue lies in the lazy loading: import type { StorybookConfig } from '@storybook/react-webpack5';
const config: StorybookConfig = {
stories: [
// Got rid of these:
// '../src/**/*.mdx',
// '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)',
// Added the story manually
'../src/components/Button/Button.stories.tsx',
],
// the rest remains the same...
};
export default config; |
I am also having the same issue here. Storybook is importing all of my other components that are not even imported in the stories. Causing so many issues.. on top of that, the example linked in the repo from dannyhw/expo-storybook-starter for react-native-web also doesn't seem to work for me. I have to install @storybook/addon-styling-webpack for some reason to make it work.. |
Describe the bug
Storybook imports random files when used with
@storybook/addon-react-native-web
.This causes the build to fail.
An example repository can be found here and the failing build here.
You can see the error is:
This is a typical transpilation error that you see with
react-native-web
- but the<ImageProgress />
component is not being imported in to any of the stories (of which there is only one: https://github.com/ChrisEdson/storybook-test/blob/main/src/components/ui/DesignSystemHeadlineFive.stories.tsx).I'm really confused by this. The
stories
property inmain.js
only specifies stories to be included:stories: ["../src/**/*.stories.@(js|jsx|ts|tsx)"],
To Reproduce
https://github.com/ChrisEdson/storybook-test
System
The text was updated successfully, but these errors were encountered: