-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[6.0.0-beta.2] Storybook v6 not working with Typescript #10662
Comments
@seaneking do you have a repro we can look at? |
It's in a private repo unfortunately, but reducing to a minimum repro with the following config still has the same error: main.js const path = require('path');
module.exports = {
stories: ['../src/components/**/*.stories.(ts|tsx)'],
addons: [
{
name: '@storybook/preset-typescript',
options: forkTsCheckerWebpackPluginOptions: {
tsconfig: path.resolve(__dirname, '../tsconfig.json')
}
},
'@storybook/addon-docs'
]
}; Button.story.tsx import React from 'react';
import { Button, ButtonProps } from '.';
export default {
title: 'Button',
component: Button
};
export const Default = ({
href = '/',
busy = false,
theme = 'default',
disabled = false,
responsive = true
}: ButtonProps) => (
<Button {...{ href, busy, theme, disabled, responsive }}>Click me</Button>
); tsconfig.json {
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"jsx": "react",
"strict": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true
},
"include": ["src/**/*", "types/**/*"]
} |
@seaneking thanks for the additional info. is there any chance you can create a minimal repo with those files (and package.json and whatever else is needed to get it to run and fail)? would really help out, since we have literally hundreds of open issues, and i'd love to get to the bottom of this and get it fixed. |
I agree with @shilman - having a reproduction will be immensely helpful here. We have a demo of this working in the presets repo, you could also cross-reference that? |
Sure thing I'll see what I can do, pretty slammed with a deadline atm but I'll try and put something together over the weekend. It's also running in a Gatsby site if that's of any relevance. |
We've just released zero-config typescript support in 6.0-beta. Please upgrade and test it! Thanks for your help and support getting this stable for release! |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
I have same issue. Using clean rc 6.0.2.
|
@ron23 do you have a repro repo i can look at? |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
For what it's worth, I have the exact same issue as original poster. It's also in a private repo, and interestingly I'm noticing this on a setup that doesn't yet involve consuming any custom stories or any of my own code -- I'll see if I can repro in a fresh repo but it does seem suggestive that running this in a root directory with no custom stories and no custom config, yet the build step fails to parse the TS from the initialized stories. |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
@shilman the dropdown branch here reproduces the issue: iambumblehead/react-dropdown-now#103 npm ci && npm start
|
@iambumblehead i'm not able to reproduce on that branch |
@shilman I cloned the branch now on a linux system and no error occurred. The error I encountered about 5 hours ago happened on a mac system. Possibly, this is "mac" issue? I'll delete node_modules on the mac, re-install and try again there and report back the result. later: yes this issue occurs on a mac with a freshly cloned instance of the branch
|
@iambumblehead i'm also on a mac? 🤷♂️ i'm on node 15 tho? |
@shilman thank you for your response. The dropdown exhibited a similar error when used in a sandbox environment without storybook. The problem was multiple versions of react introduced through the dropdown. The solution (which did not come from me btw) was to use peerDependencies to ensure that react from the parent-component would be used and, when including the dropdown in another environement, to remove react from the dropdown's node_modules or to remove the dropdown's node_modules altogether. For anyone trying to resolve a similar issue, the discussion in this PR may be useful iambumblehead/react-dropdown-now#104 |
I just replied in this thread #9610 with a similar issue happening with @storybook/react v6.3.10 what seems to happen is that typescript transpiles modules to |
Are there any solutions? I'm having the same issue on v6.5.9. |
@ron23 could you find any solution? I'm having the same issue |
Hi there! Thank you for opening this issue, but it has been marked as |
I'm afraid we need to close this issue for now, since we can't take any action without the requested reproduction or additional information. But please don't hesitate to open a new issue if the problem persists – we're always happy to help. Thanks so much for your understanding. |
Describe the bug
Using the Storybook v6 beta with
@storybook/preset-typescript
fails, throwing an error for loading JSX in stories.Minimal repro has this error:
To Reproduce
Steps to reproduce the behavior:
@storybook/react@next
and@storybook/preset-typescript@next
Expected behavior
Should be able to load Typescript components/stories and load JSX
Screenshots
System:
Additional context
N/A
The text was updated successfully, but these errors were encountered: