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

refactor: Chunk.modules => Chunk.mapModules (webpack v3.0.0) #543

Closed
Closed
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 index.js
Expand Up @@ -269,7 +269,7 @@ ExtractTextPlugin.prototype.apply = function(compiler) {
async.forEach(chunks, function(chunk, callback) {
var extractedChunk = extractedChunks[chunks.indexOf(chunk)];
var shouldExtract = !!(options.allChunks || isInitialOrHasNoParents(chunk));
async.forEach(chunk.modules.slice(), function(module, callback) {
async.forEach(chunk.mapModules(function(c) { return c; }), function(module, callback) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having just refactored this entire plugin, there are 4/5 instances of chunk.modules.something

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about function (m) { return m; } for precise initials?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c === chunk the naming convention is as it should be

Copy link

@JLHwung JLHwung Jun 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mapModules map functions on each module so the iteratee will be called with each module. See https://github.com/webpack/webpack/pull/4764/files#diff-8941681d920ac4feda44f522b986c2d0R115

var meta = module[NS];
if(meta && (!meta.options.id || meta.options.id === id)) {
var wasExtracted = Array.isArray(meta.content);
Expand Down