It's not actually a bug, but I think am not the only one who was faced with this problem. I've spent many hours on debugging, but finally I found where the problem was. I hope my experience will help other people.
I was faced with the next problem:
*.stories.tsx files) require-s them one by one_client.logger.warn)So when some story fails:
It may be too sophisticated to figure out that there's a problem and how to solve it. I got into such a situation. It looks like everything is perfect, but you know that should be another one story. And you don't know where to dig to find a problem.
In my case it was the next problem:
imports a file that throws an error (bug in my app)requires it
On the client side there's this code ^. It caught the error. The error contains everything the developer needs to know about the problem and to solve it. But it may be hidden from him because the storybook preview app handles it like it's a warning.
I think there're at least two possible improvements:
warn with errorIn my humble opinion error is much better, because those errors are almost ever fatal or the like. But I may not know something important...
Also may be it's not a bad idea to write something about possible important warnings in the documention in a chapter like "troubleshooting". I tried to google how to troubleshoot storyview but wasn't succced in it.
I'm confused. Is this a Storybook warning that you'd like to yield an error? Or just client-side log warnings in general? This looks like a very specific bug in your code, I'm not sure how Storybook would help you with that.
Hm. It's an interesting question. I made a better look at the error and... It looks like it's a runtime error on the client-side that occurs during the story initialization process (before the story has registered itself). I will try tomorrow to make some simple example or to narrow the case.
BTW I'll change the issue's description, because now I figured out that it isn't related to build process, it's in runtime. So the build is already made correctly when the error is thrown.
I have updated the issue's text. I hope it's a bit more clear now. I will prepare more information about it tomorrow after a small investigation.
I reproduced the mini example: https://github.com/faiwer/storybook-13366
It's pretty simple. There're only 2 story-files:
./src/a.stories.tsx./src/b.stories.tsxEach of them has one story inside. But the 2nd file (b) has an import './error' line. This error.tsx throws an error. I just immitated my real situation as simple as I could. Of course in the real world code there will be something more complicated than just throw new Error.
What do we have in result?
UI doesn't have b story:

Terminal doesn't show any error:

Chrome doesn't show any error:

But there's a problem. The story is not shown. And there's no information about what was wrong with it. Hm...
But actually It is there:

Why does it happen? Why does it show a warning instead of an error? Because of this code:

As you can see it deliberately shows a warning. Not an error.
Ok. But you may ask - what's the problem? Warning is shown? Hm... I think there're many developers who hides warnings in the applications because there're too many irrelevant information:
And the problem is - when you don't know that the error is in "warnings" section - you don't have a clue how to debug this issue :)
So my proposition is: just replace .warn with .error, at least because it's an error :)