Storybook: Inconsistencies when referencing paths in main.js file

Created on 6 Feb 2020  路  7Comments  路  Source: storybookjs/storybook

Describe the bug
Given the following config:

image

We can notice the following setup:

| Stories Path | Path for installed addons | Path for custom addons |
|--------------------------|---------------------------|---------------------------------------|
| Relative to main.js file | Looks in node_modules | Relative to root directory of project |

This results in an obscure stack trace that can eventually be resolved through dissecting the logs and trial and error.

Expected behavior
I would expect installed addons to default to node_modules as they currently are. However I would like custom addons to follow the same convention as the stories property.

Screenshots
included

Code snippets
included

System:
Storybook 5.3.12

Additional context
The docs for creating a custom addon are also unclear if there is any importance on where the register.js file should live, and if it must be called register.js.

The docs issue seems simple enough to fix, and my first guess is that the path inconsistency can be resolved with node's path module. If this is the case, I'd be happy to take this up as a first-PR if this is valid and not already fixed in 6.0.

Thanks so much for your work on the project!

BREAKING CHANGE configuration question / support todo

Most helpful comment

For me, relative to main.js is most intuitive. Also I think everybody's using stories, but not many people are using custom addons, so if we make it a breaking change in 6.0 it will only affect a few users.

All 7 comments

cc @ndelangen

I think generally the root of the project would make more sense, WDYT @shilman ?

For me, relative to main.js is most intuitive. Also I think everybody's using stories, but not many people are using custom addons, so if we make it a breaking change in 6.0 it will only affect a few users.

Ok, so the consensus is to make this a breaking change in 6.0 to make it always relative to the main.js file.

AFAIK this has been fixed, I remember there being a bug on the fix, that has also been fixed (with absolute paths being joined too)

I think this issue can be closed. Would anyone be able to check if this is correct?

See the PR: https://github.com/storybookjs/storybook/pull/11368

That should fix this!

Ol茅!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-beta.44 containing PR #11368 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sakulstra picture sakulstra  路  3Comments

MrOrz picture MrOrz  路  3Comments

miljan-aleksic picture miljan-aleksic  路  3Comments

levithomason picture levithomason  路  3Comments

purplecones picture purplecones  路  3Comments