Skip to content

Adds support for preLoaders in custom webpack config#107

Merged
arunoda merged 2 commits intostorybookjs:masterfrom
stewartduffy:master
Apr 13, 2016
Merged

Adds support for preLoaders in custom webpack config#107
arunoda merged 2 commits intostorybookjs:masterfrom
stewartduffy:master

Conversation

@stewartduffy
Copy link
Copy Markdown
Contributor

Fixes #90

Adds support for preLoaders to be added to custom webpack config. This allows you to use preLoaders that need to be run before loaders, like code linting, hinting etc.

Was considering adding support for postLoaders too, but I don't have any experience with them so will leave it for now.

Comment thread src/server/config.js Outdated
module: {
...config.module,
// We need to use our and custom loaders.
preLoaders: [
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actually, there's a much better generic way to deal with this.
Try this instead of this one. I hope it'll work.

...customConfig.module || {},

If this works, send me a PR with that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think we need on each loader, because if we default to empty object it won't use default config.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, this won't work, if we do it ^ this way and customConfig.module contains loader it will override loader in config.module.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm. Did you try that, it's add loaders but in the line 62 it'll get override again with the our own loaders?
If that's not working, I'll take this in.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ahh I see. Sorry I misunderstood, I thought you meant remove whole loaders: [] block too. But this works nicely. Thanks!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome.

@arunoda
Copy link
Copy Markdown
Member

arunoda commented Apr 13, 2016

This is great. Thanks.

@arunoda arunoda merged commit f3e1a16 into storybookjs:master Apr 13, 2016
@arunoda
Copy link
Copy Markdown
Member

arunoda commented Apr 13, 2016

Released with v1.12.0

wyattdanger pushed a commit to wyattdanger/react-storybook that referenced this pull request Apr 26, 2016
* Adds support for preLoaders in custom webpack config

* Changes the way it loads custom webpacck config to more generic way. Support for postLoaders
@shilman shilman added the misc label May 27, 2017
@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Mar 17, 2024

View your CI Pipeline Execution ↗ for commit 2005b27

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 1m 7s View ↗

☁️ Nx Cloud last updated this comment at 2025-09-18 02:27:44 UTC

yannbf pushed a commit that referenced this pull request Apr 17, 2025
story-exports: provide better feedback when using filters
@dosubot dosubot bot added the documentation label Dec 8, 2025
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.

3 participants