Skip to content
This repository was archived by the owner on Dec 17, 2025. It is now read-only.

Feature/get loader config - #23

Merged
sokra merged 3 commits into
webpack:masterfrom
jhnns:feature/get-loader-config
Apr 9, 2016
Merged

Feature/get loader config#23
sokra merged 3 commits into
webpack:masterfrom
jhnns:feature/get-loader-config

Conversation

@jhnns

Copy link
Copy Markdown
Contributor

Currently, there are several loaders (less-loader, sass-loader, html-loader, markdown-loader) that accept "programmable" options like functions, regexes, etc. that are hard/impossible to stringify.

The getLoaderConfig unifies the way how configs are provided to loaders by first trying to read the options from the webpack.config.js under the given property key. After that, query options are merged into the object.

getLoaderConfig is described as the recommended way to retrieve the config in the README. After maintaining several loaders, I think we should encourage the users to put their loader configs on the webpack.config.js. Do you agree? @webpack/collab-team @sokra @webpack/html-loader-team

Please give feedback before merging this in.

Unifies the way how configs are provided to loaders.
@bebraw

Copy link
Copy Markdown

This seems like a cool idea.

Obviously the main handicap is that we'll need to convince loader authors to adopt the API. But I guess there's no other way: 👍

@jhnns

Copy link
Copy Markdown
ContributorAuthor

Obviously the main handicap is that we'll need to convince loader authors to adopt the API

Yep, but the good thing is that it's not a breaking change. Things will just work for all other users.

Comment threadtest/index.js Outdated
assert.deepEqual(config, {slices:8});
});
it("should throw an error if the default config key is missing", function () {
assert.throws(function () {

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.

spacing

@jhnns

Copy link
Copy Markdown
ContributorAuthor

Is this PR obsolete with webpack 2?
https://gist.github.com/sokra/27b24881210b56bbaff7#loaders-configuration

@sokra
sokra merged commit 11e4eed into webpack:masterApr 9, 2016
@jhnns

Copy link
Copy Markdown
ContributorAuthor

Thx @sokra. Do you think that this is obsolete with webpack2?

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@jhnns@bebraw@sokra