-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Support webpack.config.ts #3780
Comments
Resolved in #3785. |
Seems that there is some issue when dealing with "normal" "webpack.config.js". After updating I get this error:
I overlooked this first as this does not throws (which it probably should do). Also I am wondering what it should do for configs which do not require transpilation. The "interpret" package returns |
@swernerx Why do you think it should throw? |
I think it should throw because there might be unwanted side-effects if my very own config is not loaded. This has to be very explicit and visible to the user. Ignoring the issue somewhat by only raising a warning is IMHO not enough. Just falling back to some default is clearly not what the user expects when defining a custom webpack config. But this is really another discussion. The bug right now is that actually two folded:
The second issue is about this code:
We really shouldn't hide e.g. parse errors. |
For 1., handling FYI, you can use permalink to link specific code like following (which gives a hyperlink to the file) |
I'll do a PR. Will probably be done during the this week. |
So is loading a custom |
@pelotom It works well. It just displays annoying warning when you use |
are you sure? I just tried upgrading from latest 3.x to 4.0.0-alpha.13 and it seems like at least webpack aliases defined in webpack.coonfig.js aren't loaded any more. |
One thing I discovered is that currently if |
@pelotom Silently? I mean, at least it will displays @sakulstra At least I tested it with my commercial project and storybook examples for |
I thought @swernerx' comment was about if you use an unsupported language extension for your webpack config... I'm talking about there being a thrown error inside your webpack config. |
@pelotom See 2. of #3780 (comment), he mentioned about error emitted while requiring custom webpack config. |
@Ailrun I see, thanks |
Just to be clear: I believe custom webpack.config.js isn't even being loaded right now. I was able to get a custom webpack.config.js to work when I went back to alpha.10 (before this change went in) Do you have tests you can use to confirm custom webpack configs are actually being used? |
@sirtimbly yes, I tested with the custom webpack files in the example. When custom on didn't load, it gave me an error. |
Probably your webpack config have problem and errors are swallowed by that try-catch. |
#3780: Do not display wrong warning when loading ".js" or ".json"
I can't say that this message is very helpful: I'm trying to set up the webpack config, webpack.config.ts file exists but it obviously doesn't even get read and this message doesn't say anything about how to fix it. |
Support request summary
Webpack supports something like
webpack.config.ts
withhttps://github.com/js-cli/js-interpret
, as they mentioned in https://webpack.js.org/configuration/configuration-languages/.However, in storybook, it detects fixed
webpack.config.js
in https://github.com/storybooks/storybook/blob/8757938b4104e96e4d33c292329222cdd3a68e98/lib/core/src/server/config.js#L89This makes it hard to centralize webpack config, when I use
webpack.config.ts
.Please specify which version of Storybook and optionally any affected addons that you're running
Affected platforms
The text was updated successfully, but these errors were encountered: