-
-
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
Presets: Replace config
with previewAnnotations
, remove previewEntries
#19152
Presets: Replace config
with previewAnnotations
, remove previewEntries
#19152
Conversation
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.
Looks good to me, thanks!
@@ -13,6 +13,7 @@ import { | |||
import prompts from 'prompts'; | |||
import type { AbortController } from 'node-abort-controller'; | |||
import command from 'execa'; | |||
import dedent from 'ts-dedent'; |
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.
We should add https://www.npmjs.com/package/@ianvs/prettier-plugin-sort-imports so we don't need to worry about manually organizing imports. :-D
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.
What's the difference between previewEntries
and config
? Is it that config
exports are treated as annotations (e.g. parameters
etc.)?
I think @ndelangen and I may have introduced previewEntries
as an intended replacement for config
. Since config
doesn't actually mean anything, and previewEntries
does. Since we're in a breaking release, I'd propose that we take the opportunity to sort this out properly, even if it means introducing a new preset (previewAnnotations
?)
WDYT?
Yes that's the difference.
I don't believe so, but @ndelangen could say for sure. This is where they are pulled in by the webpack builder (this is definitely a set of "entries" in the preview, not "configs"/annotations):
Actually I had it wrong, storybook/code/lib/core-server/src/presets/common-preset.ts Lines 45 to 49 in 1335697
I would suggest we replace it with a |
|
Switch `config` and `previewAnnotations`, and warn on the former.
Add to migration notes |
c9d13c5
to
62cabad
Compare
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.
Looking good!
config
with previewAnnotations
, remove previewEntries
Issue: We realised that the handling of the
previewEntries
field in the vite build wasn't quite right (it was treating them identically toconfig
entries, which have special behaviour on export).Looking in the code base, we no longer use
previewEntries
(did we ever?), so decided to essentially pseudo-deprecate them by not supporting them in the Vite builder.How to test
Check a vite sandbox.