-
Notifications
You must be signed in to change notification settings - Fork 507
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
Storybook should use dist/
Rollup bundle, not build all over again
#702
Comments
A few things:
I'll assign this to @kylemh because I'm not totally sure the intention behind compiling etc a second time around is vs. doing the same as the example / what the docs say. |
Ah, welp looks like I can only assign people who have commented or collaborators. And I can't add @kylemh as a collaborator, only Jared can do that 😕 |
I think this is a pretty low priority for me. I simply don’t mind it running again 🤷♂️ |
@kylemh please let me clarify why this is an extremely important goal. It’s not simply a matter of running twice So imagine you configure your Storybook webpack file to properly in-line your SVGs but the rollup build wasn’t. Then you build your library (via rollup) and discover that your SVGs are missing only when a real user files a bug in production. |
So then the problem is you’re separating the configs beyond how they exist by default. Out of the box they compat fine 🤷♂️ Whatever you do to one config the equivalent should happen in the other (in case you won’t be resolving this issue with a PR) I’m not saying this isn’t an issue. It's obviously better to build once and serve anywhere. This is just not a problem I’m encountering personally. I’ve got a few other issues in this repo I care a lot more about resolving. |
I’m not separating the configs— they already were. In the template, there is a Storybook build (via webpack configured in .storybook/main.js) and a build for the library (via Rollup and configured in tsdx.config.json). As far as I am aware, there is no sharing between the build process besides the fact that the webpack watcher watches the folder that rollup writes to. However, if webpack was set up to not read the library code from ./src but instead to read it from ./dist then Storybook would be loading the real library as if it were a true consumer. And that’s the goal that is currently not being achieved. |
It’s not so simple. As @agilgur5 mentioned there are some addons as part of the TS preset which won’t work if we simply target the existing bundle. Storybook has its own bundling process which we’d need to account for and translate to TSDX |
@kylemh I pinged you because I wasn't sure of the intentionality of using @dgreene1 I should've mentioned this at the beginning, but these are just templates, you can change your stories's |
Right. I already target |
I confirmed that For me, the value of seeing my widgets exactly as what is going to be exported is worth it for me, so I'm personally sticking with importing via However, I believe that Storybook 6.0 (with it's new and improved doc pages) is going to be including a zero-config typescript setup. So once that is published and this related issue (storybookjs/storybook#10738) is resolved, I would be happy to migrate the Storybook template in tsdx to utilize doc-pages instead of |
💯 there are a few issues touching on Storybook in this repo. I've honestly been waiting for v6 to release before I change anything here. |
Apologies for the delays @agilgur5 @shilman - got laid off and had to deal with a job hunt. Luckily, my new workplace wants me to get a component library going! I'm hoping to resolve all the issues assigned to me and then be a consumer again. I'll be using Storybook v6 alpha as the release is scheduled for July 31st. |
@jaredpalmer since you moved this to the Formium org, I wanted to suggest that @agilgur5 be added as a member of the team so he can assign Storybook preset things to me. I'd gladly join the org too if you feel like I've done enough, but no worries if not. |
Yeah makes sense. Sorry for the name changes. To avoid confusion with the open source library, we’re renaming what was formerly Formik Cloud to Formium. |
I'm just happy it's in an org now! |
Oh, he already seems to be a member and I was already assigned to a few issues. So, I just need to be assigned to this one. |
@dgreene1 regarding your efforts here: #702 (comment) @shilman has a v6 alpha up and running: storybookjs/storybook#10738 (comment) It looks like Storybook is using react-docgen-typescript-plugin now. Any way to quickly identify if it can generate tables properly from types? |
There’s no quick way other than migrating fully to v6, which I wasn’t planning on doing till it’s fully released (not sure what the term is for when it’s no longer in alpha). Someone else might need to try if you need an answer sooner. Otherwise I’ll be replying to this thread once v6 of storybook is fully released. |
No worries. I'll give it a whirl. |
Still prerelease (RC now) and targeting final release for end of July earl August. There's still some loose ends, but the TypeScript side of things has held up pretty well so far during the RC and feels light years better than the hot mess it replaces. If anybody here can kick the tires, I'd love to make sure it plays nicely with TSDX before we do the final release! 🙏 |
@kylemh to clarify, I'm in fact not a "Member" of the org, I'm a "Collaborator" of the repo. "Collaborators" have a very limited set of permissions, basically write access and some community moderation things. Adding "Members" to "Teams" also allows one to add more fine-grained permissions, for instance, issue triage but not write-access, write-access but not admin. Branch protection also isn't set up (and I don't have permissions to set it), so write access means ability to change main branch as well (whereas PR-only is best practice). |
dist/
Rollup bundle, not build all over again
It's released, @dgreene1 ! I doubt this will be possible given the compilation process involved around I spoke with @shilman about this (thanks for the reminder @agilgur5), and he suggested there may be a way to do upstream changes to |
FYI @yhy-vertex this is the issue that's blocking our types from coming in. |
Concerning the issue with broken docs when importing from I solve it by wrapping components imported from Below is a simple HOC that does nothing but drilling props to a passed component and reexporting example ( import React from 'react';
import {
DashedRectangle as DashedRectangleBase,
ColorExamples as ColorExamplesBase,
} from '@scooter/core'; // this is pointing to a lerna package's dist folder,
function withDocsEnabled<P>(Component: React.FC<P>) {
return (props: React.PropsWithChildren<P>) => <Component {...props} />;
}
export const DashedRectangle = withDocsEnabled(DashedRectangleBase);
export const ColorExamples = withDocsEnabled(ColorExamplesBase); |
Current Behavior
If you want enhance the build (like adding fonts for instance), you currently have to do that in two places:
.storybook/main.js
where you would use Webpack's 'file-loader'tsdx.config.js
where you would use '@rollup/plugin-url'Desired Behavior
I would ideally not have to modify the Storybook build to pull in the fonts at all. By the very nature of telling rollup to include the fonts, Webpack would get them because it would be including the compiled output that lives in dist.
Suggested Solution
Who does this impact? Who is this for?
I'm not sure.
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: