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

fix: corrected order for chunk.modules #563

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -61,7 +61,7 @@
"node": ">= 4.3 < 5.0.0 || >= 5.10"
},
"peerDependencies": {
"webpack": "^3.0.0"
"webpack": "^3.1.0"
},
"homepage": "http://github.com/webpack-contrib/extract-text-webpack-plugin",
"repository": {
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Expand Up @@ -144,6 +144,7 @@ class ExtractTextPlugin {
async.forEach(chunks, (chunk, callback) => { // eslint-disable-line no-shadow
const extractedChunk = extractedChunks[chunks.indexOf(chunk)];
const shouldExtract = !!(options.allChunks || isInitialOrHasNoParents(chunk));
chunk.sortModules();
async.forEach(chunk.mapModules((c) => { return c; }), (module, callback) => { // eslint-disable-line no-shadow, arrow-body-style
let meta = module[NS];
if (meta && (!meta.options.id || meta.options.id === id)) {
Expand Down
1 change: 1 addition & 0 deletions test/cases/chunk-modules-ordered-by-id/a.js
@@ -0,0 +1 @@
require('./c.txt');
3 changes: 3 additions & 0 deletions test/cases/chunk-modules-ordered-by-id/b.txt
@@ -0,0 +1,3 @@
.block {
color: tomato;
}
3 changes: 3 additions & 0 deletions test/cases/chunk-modules-ordered-by-id/c.txt
@@ -0,0 +1,3 @@
.App {
color: black;
}
6 changes: 6 additions & 0 deletions test/cases/chunk-modules-ordered-by-id/expected/file.css
@@ -0,0 +1,6 @@
.block {
color: tomato;
}
.App {
color: black;
}
2 changes: 2 additions & 0 deletions test/cases/chunk-modules-ordered-by-id/index.js
@@ -0,0 +1,2 @@
require('./a');
require('./b.txt');
7 changes: 7 additions & 0 deletions test/cases/chunk-modules-ordered-by-id/webpack.config.js
@@ -0,0 +1,7 @@
var ExtractTextPlugin = require("../../../");
module.exports = {
entry: "./index",
plugins: [
new ExtractTextPlugin("file.css")
]
};