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

Adds support for preLoaders in custom webpack config #107

Merged
merged 2 commits into from
Apr 13, 2016

Conversation

stewartduffy
Copy link
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.

@@ -56,6 +56,9 @@ export default function (baseConfig, configDir) {
module: {
...config.module,
// We need to use our and custom loaders.
preLoaders: [
Copy link
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
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
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
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
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
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
Member

arunoda commented Apr 13, 2016

This is great. Thanks.

@arunoda arunoda merged commit f3e1a16 into storybookjs:master Apr 13, 2016
@arunoda
Copy link
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
Copy link

nx-cloud bot commented Mar 17, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 2005b27. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

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.

3 participants