storybook icon indicating copy to clipboard operation
storybook copied to clipboard

context.parameters.fileName is different in static build

Open Utzel-Butzel opened this issue 5 years ago • 7 comments

Describe the bug When using context the parameters.fileName is the actual path (e.g. /folder/Button-story.js) in development but will switch to a number (e.g. 1021) in static production build.

To Reproduce Steps to reproduce the behavior: Output context in production build.

Expected behavior context should be the same in development and production

Code snippets

export const withNotes = makeDecorator({
  wrapper: (context) => {
    console.log(context.parameters.fileName);
});

System:

  • Version: 5.1.8

Utzel-Butzel avatar Jun 17 '19 10:06 Utzel-Butzel

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

stale[bot] avatar Jul 08 '19 15:07 stale[bot]

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

stale[bot] avatar Aug 07 '19 15:08 stale[bot]

I have the same question. Is there a way to get filename in a build?

imdongchen avatar Dec 20 '19 18:12 imdongchen

Me too! Breaks my addon

gavmck avatar Jun 10 '20 13:06 gavmck

bump

OutThisLife avatar Sep 23 '20 15:09 OutThisLife

Same here. Still a bug in 6.1

tim-mukhin avatar Mar 05 '21 19:03 tim-mukhin

@gavmck @imdongchen @Utzel-Butzel @shilman I found the workaround here https://github.com/storybookjs/storybook/issues/5907#issuecomment-470015950 Thought it should be already fixed, but as I've mentioned, it's still an issue in 6.1.

I guess if a project wants to use it's own webpack config, it will most likely turn on optimization and get caught on this bug. I suppose it would be helpful to point this out in the documentation.

tim-mukhin avatar Mar 06 '21 10:03 tim-mukhin