diff --git a/index.js b/index.js index 82f1acff..b216c187 100644 --- a/index.js +++ b/index.js @@ -289,7 +289,7 @@ ExtractTextPlugin.prototype.apply = function(compiler) { extractedChunks.forEach(function(extractedChunk) { if(extractedChunk.modules.length) { extractedChunk.modules.sort(function(a, b) { - if(isInvalidOrder(a, b)) { + if(!options.ignoreOrder && isInvalidOrder(a, b)) { compilation.errors.push(new OrderUndefinedError(a.getOriginalModule())); compilation.errors.push(new OrderUndefinedError(b.getOriginalModule())); } diff --git a/test/cases/order-undefined-error/a.css b/test/cases/order-undefined-error/a.css new file mode 100644 index 00000000..8abd6bfb --- /dev/null +++ b/test/cases/order-undefined-error/a.css @@ -0,0 +1,4 @@ +.a { + composes: c1 from './c1.css'; + composes: c2 from './c2.css'; +} diff --git a/test/cases/order-undefined-error/b.css b/test/cases/order-undefined-error/b.css new file mode 100644 index 00000000..bbc901f7 --- /dev/null +++ b/test/cases/order-undefined-error/b.css @@ -0,0 +1,4 @@ +.b { + composes: c2 from './c2.css'; + composes: c1 from './c1.css'; +} diff --git a/test/cases/order-undefined-error/c1.css b/test/cases/order-undefined-error/c1.css new file mode 100644 index 00000000..af144e72 --- /dev/null +++ b/test/cases/order-undefined-error/c1.css @@ -0,0 +1,2 @@ +.c1 { +} diff --git a/test/cases/order-undefined-error/c2.css b/test/cases/order-undefined-error/c2.css new file mode 100644 index 00000000..f9e9e192 --- /dev/null +++ b/test/cases/order-undefined-error/c2.css @@ -0,0 +1,2 @@ +.c2 { +} diff --git a/test/cases/order-undefined-error/expected/file.css b/test/cases/order-undefined-error/expected/file.css new file mode 100644 index 00000000..b87b58bd --- /dev/null +++ b/test/cases/order-undefined-error/expected/file.css @@ -0,0 +1,8 @@ +._3QiTkN7JPds2C9Bq73MpOX { +} +._3dtwYD12yqGZUJ-uPQLu9z { +} +._32HVXkGocfWZMaHoXEFkED { +} +.hbZI7DlQBB9VYNCgL20kL { +} diff --git a/test/cases/order-undefined-error/index.js b/test/cases/order-undefined-error/index.js new file mode 100644 index 00000000..a2a7578a --- /dev/null +++ b/test/cases/order-undefined-error/index.js @@ -0,0 +1,2 @@ +require('./a.css'); +require('./b.css'); diff --git a/test/cases/order-undefined-error/webpack.config.js b/test/cases/order-undefined-error/webpack.config.js new file mode 100644 index 00000000..c86c7b28 --- /dev/null +++ b/test/cases/order-undefined-error/webpack.config.js @@ -0,0 +1,15 @@ +var ExtractTextPlugin = require("../../../"); +module.exports = { + entry: "./index.js", + module: { + loaders: [{ + test: /\.css$/, + loader: ExtractTextPlugin.extract('style', 'css?modules') + }] + }, + plugins: [ + new ExtractTextPlugin('file.css', { + ignoreOrder: true + }) + ] +}