Skip to content
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

Storysource: Fallback to the docs.source.originalSource parameter #21159

Merged
merged 1 commit into from
Feb 20, 2023

Conversation

shilman
Copy link
Member

@shilman shilman commented Feb 20, 2023

Closes #20421

What I did

Fallback to us the source provided by the docs.source.originalSource parameter.

There is a long history to this hack of a PR. The TLDR is that:

  1. This data should be provided by source-loader in the storySource.source parameter. However, source-loader caused a performance regression in the Vite builder, so I reverted it.
  2. In Vite, csf-plugin runs always (currently), so we can expect the docs.source.originalSource to be there.

The addon will prefer storySource.source for legacy support, but also use docs.source.originalSource if it's not there.

Note that in webpack:

  • source-loader IS run
  • csf-plugin IS NOT run unless addon-docs is enabled

Hopefully this all gets replaced with the annotation server in 7.x...

How to test

Run a Vite sandbox with the storysource addon:

yarn task --task dev --template react-vite/default-ts -a storysource

Verify that the code shows up in the Code addon panel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Storysource add-on *depends* on Docs add-on to work
2 participants