Skip to content

Commit 1a29dd6

Browse files
authored
Merge pull request faceyspacey#232 from insin/patch-1
Fix handling of loaders as objects without a query prop
2 parents 2cf2e87 + a36dbf8 commit 1a29dd6

File tree

6 files changed

+36
-1
lines changed

6 files changed

+36
-1
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ module.exports = ExtractTextPlugin;
130130

131131
// modified from webpack/lib/LoadersList.js
132132
function getLoaderWithQuery(loader) {
133-
if(isString(loader) || !loader.query) return loader;
133+
if(isString(loader)) return loader;
134+
if(!loader.query) return loader.loader;
134135
var query = isString(loader.query) ? loader.query : JSON.stringify(loader.query);
135136
return loader.loader + "?" + query;
136137
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
correct: a;
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
correct: b;
3+
}

test/cases/simple-queryless-object/expected/file.css

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require("./a.css");
2+
require("./b.css");
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
var ExtractTextPlugin = require("../../../");
2+
module.exports = {
3+
entry: "./index",
4+
module: {
5+
loaders: [
6+
{ test: /\.css$/, loader: ExtractTextPlugin.extract({
7+
fallbackLoader: { loader: "style-loader" },
8+
loader: { loader: "css-loader", query: {
9+
sourceMap: true
10+
} }
11+
}) }
12+
]
13+
},
14+
devtool: "source-map",
15+
plugins: [
16+
new ExtractTextPlugin("file.css")
17+
]
18+
};

0 commit comments

Comments
 (0)