-
-
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
Add support for .storybook/main.ts
file
#9765
Comments
@sentilesdal |
hey, it's actually possible. check this out #9775 |
Yay!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-alpha.9 containing PR #9775 that references this issue. Upgrade today to try it out! You can find this prerelease on the Closing this issue. Please re-open if you think there's still more to do. |
@shilman did you mean to reopen this issue? |
Yeah I think @igor-dv also wanted to make some documentation updates |
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! |
Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook! |
Is there a type for the Update: I can see the type |
Not yet, coming in 6.1 #11843 |
Ok, thanks! I used import { StorybookConfig } from '@storybook/core/types'; |
Hi everyone! I've just updated Storybook to 6.1.1 and I have the following error: yarn run v1.22.4
$ start-storybook -p 6006 -c storybook
info @storybook/react v6.1.1
info
info => Loading custom manager config
ERR! SyntaxError: /Users/mlshv/code/timestripe-web/frontend/storybook/main.ts: Unexpected token, expected ";" (28:2)
ERR!
ERR! 26 | },
ERR! 27 | },
ERR! > 28 | } as StorybookConfig
ERR! | ^
ERR! 29 |
ERR! 30 | export default config
ERR! 31 |
ERR! at Parser._raise (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:742:17)
ERR! at Parser.raiseWithData (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:735:17)
ERR! at Parser.raise (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:729:17)
ERR! at Parser.unexpected (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:8779:16)
ERR! at Parser.semicolon (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:8761:40)
ERR! at Parser.parseVarStatement (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:11573:10)
ERR! at Parser.parseStatementContent (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:11171:21)
ERR! at Parser.parseStatement (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:11104:17)
ERR! at Parser.parseBlockOrModuleBlockBody (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:11679:25)
ERR! at Parser.parseBlockBody (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:11665:10)
ERR! at Parser.parseTopLevel (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:11035:10)
ERR! at Parser.parse (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:12671:10)
ERR! at parse (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:12722:38)
ERR! at parser (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/core/lib/parser/index.js:54:34)
ERR! at parser.next (<anonymous>)
ERR! at normalizeFile (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/core/lib/transformation/normalize-file.js:93:38)
ERR! SyntaxError: /Users/mlshv/code/timestripe-web/frontend/storybook/main.ts: Unexpected token, expected ";" (28:2)
ERR!
ERR! 26 | },
ERR! 27 | },
ERR! > 28 | } as StorybookConfig
ERR! | ^
ERR! 29 |
ERR! 30 | export default config
ERR! 31 |
ERR! at Parser._raise (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:742:17)
ERR! at Parser.raiseWithData (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:735:17)
ERR! at Parser.raise (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:729:17)
ERR! at Parser.unexpected (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:8779:16)
ERR! at Parser.semicolon (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:8761:40)
ERR! at Parser.parseVarStatement (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:11573:10)
ERR! at Parser.parseStatementContent (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:11171:21)
ERR! at Parser.parseStatement (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:11104:17)
ERR! at Parser.parseBlockOrModuleBlockBody (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:11679:25)
ERR! at Parser.parseBlockBody (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:11665:10)
ERR! at Parser.parseTopLevel (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:11035:10)
ERR! at Parser.parse (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:12671:10)
ERR! at parse (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/parser/lib/index.js:12722:38)
ERR! at parser (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/core/lib/parser/index.js:54:34)
ERR! at parser.next (<anonymous>)
ERR! at normalizeFile (/Users/mlshv/code/timestripe-web/frontend/node_modules/@babel/core/lib/transformation/normalize-file.js:93:38) {
ERR! loc: Position { line: 28, column: 2 },
ERR! pos: 772,
ERR! code: 'BABEL_PARSE_ERROR'
ERR! }
WARN Broken build, fix the error above.
WARN You may need to refresh the browser. It seems like Babel tries to transpile main.ts as if it were main.js file. What am i doing wrong? |
Experienced something similar. Tried to put |
To run |
@barinbritva it should work automatically in
|
i'm getting |
@stefanprobst from inside the storybook monorepo in the
|
@shilman, thanks I'll try. But I just copied content of |
Is your feature request related to a problem? Please describe.
The current documentation shows using a
main.js
file for configuring storybook. However, using amain.ts
file is not currently supported which makes importing from other typescript files impossible. Since the newmain.js
file includes an option to customize the webpack configuration, I'd like to be able to import rules from the project'swebpack.config.ts
.Describe the solution you'd like
Support for a
main.ts
file out of the box.Describe alternatives you've considered
Currently the other configuration files (
addons.ts
,config.ts
etc) support using typescript). This works for now, but it is hard to find documentation for this old pattern.Are you able to assist bring the feature to reality?
Possibly, haven't looked into what's necessary to get this to work.
The text was updated successfully, but these errors were encountered: