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

Inconsistencies when referencing paths in main.js file #9773

Closed
mtliendo opened this issue Feb 6, 2020 · 7 comments
Closed

Inconsistencies when referencing paths in main.js file #9773

mtliendo opened this issue Feb 6, 2020 · 7 comments

Comments

@mtliendo
Copy link

mtliendo commented Feb 6, 2020

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!

@mtliendo mtliendo changed the title Inconsistencies when referencing paths Inconsistencies when referencing paths in main.js file Feb 6, 2020
@shilman
Copy link
Member

shilman commented Feb 6, 2020

cc @ndelangen

@ndelangen
Copy link
Member

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

@shilman
Copy link
Member

shilman commented Feb 7, 2020

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.

@stale stale bot added the inactive label Mar 1, 2020
@storybookjs storybookjs deleted a comment from stale bot Mar 2, 2020
@stale stale bot removed the inactive label Mar 2, 2020
@ndelangen ndelangen self-assigned this Mar 2, 2020
@ndelangen ndelangen added this to the 6.0.0 milestone Mar 2, 2020
@ndelangen
Copy link
Member

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

@ndelangen
Copy link
Member

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?

@ndelangen
Copy link
Member

See the PR: #11368

That should fix this!

@shilman shilman closed this as completed in 1880867 Jul 6, 2020
@shilman
Copy link
Member

shilman commented Jul 6, 2020

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.

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

No branches or pull requests

3 participants