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

Allow full control over webpack config. #160

Merged
merged 1 commit into from
May 5, 2016

Conversation

timkindberg
Copy link
Contributor

Because of very custom requirements on my project I will not be able to use storybook unless I can have more fine-grained control over the webpack config.

This pull request adds the 'full-control' features:

  • If a function is returned from the '.storybook/webpack.config.js' then it will trigger 'full-control mode'.
  • The function accepts the baseConfig from storybook and the dev can modify it with full control.
  • The function must return a webpack config object.

Example:

// .storybook/webpack.config.js

// We will export a function instead of an object, the function will accept the base config
module.exports = (storybookBaseConfig) => {
  // Make whatever fine-grained changes you need
  delete storybookBaseConfig.module.loaders[0].exclude;

  // Return the altered config
  return storybookBaseConfig;
};

@arunoda
Copy link
Member

arunoda commented May 4, 2016

@timkindberg
Copy link
Contributor Author

Awesome thanks so much!

Docs are added now!

If a function is returned from the '.storybook/webpack.config.js' then it will kick in 'full-control mode'. The function accepts the baseConfig from storybook and the dev can modify it with full control. This is necessary for more custom webpack configurations.
@arunoda
Copy link
Member

arunoda commented May 4, 2016

Okay. This looks great.
We are working on some refactors in the mantra repo. (Unrelated to this PR)

When we are releasing it, I'll take this.

@timkindberg
Copy link
Contributor Author

Thanks @arunoda! An estimate on timeframe for next release?

@arunoda
Copy link
Member

arunoda commented May 5, 2016

Within this week.

@arunoda arunoda merged commit 2328339 into storybookjs:master May 5, 2016
@moroshko
Copy link

moroshko commented May 5, 2016

Will this allow full control over webpack.config.prod.js as well, or only webpack.config.js?
It would be great if we could control webpack.config.prod.js. For example: pass options to the uglifyjs plugin.

@timkindberg
Copy link
Contributor Author

This was not for prod only dev
On Thu, May 5, 2016 at 7:23 AM Misha Moroshko notifications@github.com
wrote:

Will this allow full control over webpack.config.prod.js as well, or
only webpack.config.js?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#160 (comment)

  • Tim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants