Request for making the condition more flexible for: Expected '@storybook/addon-docs' to be listed before '@storybook/addon-essentials'
#13202
Labels
Milestone
Hey Storybook team :) Little request here:
Is your feature request related to a problem? Please describe
I'm trying to create a private package abstracting all storybook core dependencies (e.g.
@storybook/react
,@storybook/addon-essentials
,babel-loader
, etc.) so I would not have to install those manually in each of my projects.This package would also return a minimal config with some defaults for the consumer. Something like that:
When starting storybook, essentials addons do not work, and I get the following warning in the console:
After digging a bit, I've found the check in
@storybook/addon-controls
ensuring that Docs is placed before@storybook/addon-essentials
:storybook/addons/controls/src/preset/ensureDocsBeforeControls.ts
Line 11 in 6dd5e2e
The problem is that the condition uses
startsWith('@storybook/addon-essentials')
.And because my essentials addon is in a subpackage, I had to
require.resolve
it, giving the following path'/Users/jon301/my-app/node_modules/@jon301/my-storybook-preset/node_modules/@storybook/addon-essentials/dist/index.js'
, which does not satisfy thestartsWith
condition.Describe the solution you'd like
Be more flexible by replacing
name.startsWith(addon)
byname.includes(addon)
.Please let me know if you are OK with this and I'll create a PR 🙏
Thanks !
The text was updated successfully, but these errors were encountered: