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

Ability to change the manager webpack config #8203

Closed
andersekdahl opened this issue Sep 26, 2019 · 4 comments
Closed

Ability to change the manager webpack config #8203

andersekdahl opened this issue Sep 26, 2019 · 4 comments

Comments

@andersekdahl
Copy link

Is your feature request related to a problem? Please describe.
We use Typescript and to be able to have a better split between our dev/build dependencies and the dependencies the app uses we've split our projects into two "packages". Something like this:

/
/src
/src/node_modules
/src/node_modules/react
/src/package.json
/src/App.tsx
/buildsystem
/buildsystem/node_modules
/buildsystem/node_modules/storybook
/buildsystem/package.json
/buildsystem/index.ts
/build.js

We then do something like node build.js storybook to actually run stuff.

Since the buildsystem runs in Node we want TypeScript types for Node in that environment, but not for the app since that runs in the browser and not in Node. This isn't a problem for modules that you manually import, but becomes a problem for global types such as the Node types.

Storybook, webpack and other build tools are installed in the buildsystem/package.json whereas React and other runtime dependencies are installed in src/package.json. Some packages are installed in both (like Typescript) but they are very few.

This means that we want to launch Storybook from the buildsystem, and that works quite well except for the manager webpack config. The preview/app webpack config isn't a problem since we have full control over it (we use the standalone mode).

Describe the solution you'd like
The blocker for us currently is that we can't change anything in the manager webpack config which means that the Storybook manager can't find the babel-loader that's located in /buildsystem/node_modules and not in /node_modules. Which the manager assumes since the CWD is / for the build process.

So we'd like a way to tell Storybook where to look for loaders for the manager (and perhaps other dependencies as well).

Describe alternatives you've considered
Webpack by default assumes that loaders are located in /node_modules as well but we override that in the preview/app config by using resolveLoaders which works well. If we could in some way change/manipulate the manager config we could add resolveLoaders there.

That understandably might not be something this project wants to expose, since the manager is purely internal and exposing the config would make it harder to change. So another option would be to add another config parameter of where Storybook should try to resolve dependencies.

Are you able to assist bring the feature to reality?
Yes!

@shilman
Copy link
Member

shilman commented Sep 26, 2019

@andersekdahl you've read the workaround here, right? #4995

@andersekdahl
Copy link
Author

No, but I have know! I'll test the custom preset and report back, thanks!

@stale
Copy link

stale bot commented Oct 18, 2019

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 stale bot added the inactive label Oct 18, 2019
@stale
Copy link

stale bot commented Nov 17, 2019

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 stale bot closed this as completed Nov 17, 2019
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

2 participants