Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Return an array of loader objects from extract() #343

Merged
merged 2 commits into from
Jan 26, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,11 @@ function ExtractTextPlugin(options) {
}
module.exports = ExtractTextPlugin;

// modified from webpack/lib/LoadersList.js
function getLoaderWithQuery(loader) {
if(isString(loader)) return loader;
if(!loader.query) return loader.loader;
var query = isString(loader.query) ? loader.query : JSON.stringify(loader.query);
return loader.loader + "?" + query;
function getLoaderObject(loader) {
if (isString(loader)) {
return {loader: loader};
}
return loader;
}

function mergeOptions(a, b) {
Expand Down Expand Up @@ -198,8 +197,7 @@ ExtractTextPlugin.prototype.extract = function(options) {
delete options.fallbackLoader;
return [this.loader(options)]
.concat(before, loader)
.map(getLoaderWithQuery)
.join("!");
.map(getLoaderObject);
}

ExtractTextPlugin.extract = ExtractTextPlugin.prototype.extract.bind(ExtractTextPlugin);
Expand Down