-
Notifications
You must be signed in to change notification settings - Fork 512
fix(index): handle module
extraction correctly (require.ensure
)
#687
fix(index): handle module
extraction correctly (require.ensure
)
#687
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLA needs to be signed.
As @evilebottnawi suggested, this needs a failing & passing test.
Also, a bit of information about your Webpack environment would be helpful.
i.e. extract-text + webpack versions
I have commited test case and run test.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work!
@michael-ciniawsky Do you know why some CI failed?
require.ensure
@evilebottnawi There was a switch made to CircleCI for |
@michael-ciniawsky locally test passed, seems we can approved and shipped |
src/index.js
Outdated
@@ -143,7 +143,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)); | |||
const shouldExtract = !!(options.allChunks); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary parentheses
src/index.js
Outdated
if (shouldExtract && !wasExtracted) { | ||
module[`${NS}/extract`] = shouldExtract; // eslint-disable-line no-path-concat | ||
|
||
const cks = module.chunks; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cks
=> chunks
or just use module.chunks
directly
src/index.js
Outdated
// check every module's chunks.parents() to decide extract or not | ||
for (let i = 0; i < cks.length; i++) { | ||
if (!isInitialOrHasNoParents(cks[i]) && !module.noExtracted) { | ||
module.noExtracted = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
module.noExtracted
=> module.extracted
and use a {Boolean}
e.g
if (...) {
module.extracted = true;
break;
}
@michael-ciniawsky thanks for your suggestion,I have committed the code refine,please check! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lvming6816077 Thx
@michael-ciniawsky ready for merge 👍 |
@lvming6816077 I will try to get this out as soon as possible, but I need to do some chores beforehand and merge other outstanding PR's aswell (ETA ~1-2 days) |
require.ensure
module
extraction correctly (require.ensure
)
Issues