Skip to content

Commit 614c3bb

Browse files
Add ignoreOrder option to avoid the OrderUndefinedError
1 parent a599665 commit 614c3bb

File tree

8 files changed

+38
-1
lines changed

8 files changed

+38
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ ExtractTextPlugin.prototype.apply = function(compiler) {
289289
extractedChunks.forEach(function(extractedChunk) {
290290
if(extractedChunk.modules.length) {
291291
extractedChunk.modules.sort(function(a, b) {
292-
if(isInvalidOrder(a, b)) {
292+
if(!options.ignoreOrder && isInvalidOrder(a, b)) {
293293
compilation.errors.push(new OrderUndefinedError(a.getOriginalModule()));
294294
compilation.errors.push(new OrderUndefinedError(b.getOriginalModule()));
295295
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.a {
2+
composes: c1 from './c1.css';
3+
composes: c2 from './c2.css';
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.b {
2+
composes: c2 from './c2.css';
3+
composes: c1 from './c1.css';
4+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.c1 {
2+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.c2 {
2+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
._3QiTkN7JPds2C9Bq73MpOX {
2+
}
3+
._3dtwYD12yqGZUJ-uPQLu9z {
4+
}
5+
._32HVXkGocfWZMaHoXEFkED {
6+
}
7+
.hbZI7DlQBB9VYNCgL20kL {
8+
}
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: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
var ExtractTextPlugin = require("../../../");
2+
module.exports = {
3+
entry: "./index.js",
4+
module: {
5+
loaders: [{
6+
test: /\.css$/,
7+
loader: ExtractTextPlugin.extract('style', 'css?modules')
8+
}]
9+
},
10+
plugins: [
11+
new ExtractTextPlugin('file.css', {
12+
ignoreOrder: true
13+
})
14+
]
15+
}

0 commit comments

Comments
 (0)