Skip to content

Commit

Permalink
adjusted tests, remove module from base if extracted
Browse files Browse the repository at this point in the history
  • Loading branch information
BowlingX committed Jun 17, 2017
1 parent 1791796 commit 09ac8cb
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ ExtractTextPlugin.prototype.apply = function(compiler) {
if(meta && (!meta.options.id || meta.options.id === id)) {
var wasExtracted = Array.isArray(meta.content);
if(shouldExtract !== wasExtracted) {
if (shouldExtract) {
chunk.removeModule(module);
return callback();
}
module[NS + "/extract"] = shouldExtract; // eslint-disable-line no-path-concat
compilation.rebuildModule(module, function(err) {
if(err) {
Expand Down
8 changes: 6 additions & 2 deletions test/cases/multiple-entries-async/expected/0.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ webpackJsonp([0],{
/***/ 2:
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(7);
__webpack_require__(9);

modules.export = function() {
return 'Route Homepage';
};


/***/ }),

/***/ 7:
/***/ 9:
/***/ (function(module, exports) {

module.exports = "styles-homepage\n"
Expand Down
8 changes: 6 additions & 2 deletions test/cases/multiple-entries-async/expected/1.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ webpackJsonp([1],{
/***/ 1:
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(6);
__webpack_require__(8);

modules.export = function() {
return 'Route Contact';
};


/***/ }),

/***/ 6:
/***/ 8:
/***/ (function(module, exports) {

module.exports = "styles-contact\n"
Expand Down
4 changes: 4 additions & 0 deletions test/cases/multiple-entries-async/routes/contact/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
require('./styles.txt');

modules.export = function() {
return 'Route Contact';
};
4 changes: 4 additions & 0 deletions test/cases/multiple-entries-async/routes/homepage/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
require('./styles.txt');

modules.export = function() {
return 'Route Homepage';
};

0 comments on commit 09ac8cb

Please sign in to comment.