Skip to content

try/catch package.json resolve - fixes #10955#11023

Merged
ndelangen merged 5 commits into
storybookjs:nextfrom
MarkLyck:patch-3
Jun 4, 2020
Merged

try/catch package.json resolve - fixes #10955#11023
ndelangen merged 5 commits into
storybookjs:nextfrom
MarkLyck:patch-3

Conversation

@MarkLyck
Copy link
Copy Markdown
Contributor

@MarkLyck MarkLyck commented Jun 2, 2020

This fixes #10955

Issue:

What I did

Added safety around package.json resolve function.

How to test

  • Run storybook in a rollup project. It should NOT fail.

Without this fix, it fails with the error mentioned in #10955

Copy link
Copy Markdown
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we log an error in the catch block? @ndelangen can you take a close look at this? Also deepscan errors

@ndelangen
Copy link
Copy Markdown
Member

I'd like to understand why the JSON can not be found honestly.

@ndelangen
Copy link
Copy Markdown
Member

Do you have a reproduction repo for me to inspect?

@ndelangen ndelangen self-assigned this Jun 4, 2020
@ndelangen ndelangen added this to the 6.0 milestone Jun 4, 2020
@ndelangen ndelangen merged commit f82ad80 into storybookjs:next Jun 4, 2020
@michaelbayday
Copy link
Copy Markdown

michaelbayday commented Jul 2, 2020

We're not using rollup in our storybook, but it is a devdependency and storybook is throwing a warning of unable to find package.json for rollup when using version >= 2.3.4

@akmoulai
Copy link
Copy Markdown

I'm using rollup with SB and I get the same as @michaelbayday

WARN unable to find package.json for @rollup/plugin-node-resolve
WARN unable to find package.json for rollup

Seems like SB is trying to load the package.json for rollup. Is there a way to exclude it? (SB + CRA + Rollup, all vanilla and nothing special)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Storybook beta blowing up since beta.7

5 participants