-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Vite: Fix static source handling for addon-docs #20147
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { Plugin } from 'vite'; | ||
import { vite } from '@storybook/csf-plugin'; | ||
import type { StorybookConfig } from '@storybook/types'; | ||
import type { ExtendedOptions } from '../types'; | ||
|
||
export async function csfPlugin(config: ExtendedOptions): Promise<Plugin> { | ||
const { presets } = config; | ||
|
||
const addons = await presets.apply<StorybookConfig['addons']>('addons', []); | ||
const docsOptions = | ||
// @ts-expect-error - not sure what type to use here | ||
addons.find((a) => [a, a.name].includes('@storybook/addon-docs'))?.options ?? {}; | ||
|
||
return vite(docsOptions?.csfPluginOptions); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It feels to me like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think csf-plugin should know about the user's main.js and it makes sense for addon-docs to glue things together like this. Hopefully this all goes away in 7.x with the annotations server & simplifies things even further. |
||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kept a plugin so vite-config stayed clean