From 09ac8cba2f03e3dc73af6e11351b52a74678b269 Mon Sep 17 00:00:00 2001 From: David Heidrich Date: Sat, 17 Jun 2017 22:36:09 +0200 Subject: [PATCH] adjusted tests, remove module from base if extracted --- index.js | 4 ++++ test/cases/multiple-entries-async/expected/0.js | 8 ++++++-- test/cases/multiple-entries-async/expected/1.js | 8 ++++++-- test/cases/multiple-entries-async/routes/contact/index.js | 4 ++++ .../cases/multiple-entries-async/routes/homepage/index.js | 4 ++++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index ed5b11f4..cf2221a6 100644 --- a/index.js +++ b/index.js @@ -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) { diff --git a/test/cases/multiple-entries-async/expected/0.js b/test/cases/multiple-entries-async/expected/0.js index 4ab6b74e..f650a8f1 100644 --- a/test/cases/multiple-entries-async/expected/0.js +++ b/test/cases/multiple-entries-async/expected/0.js @@ -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" diff --git a/test/cases/multiple-entries-async/expected/1.js b/test/cases/multiple-entries-async/expected/1.js index 7eeb72ed..d03f8290 100644 --- a/test/cases/multiple-entries-async/expected/1.js +++ b/test/cases/multiple-entries-async/expected/1.js @@ -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" diff --git a/test/cases/multiple-entries-async/routes/contact/index.js b/test/cases/multiple-entries-async/routes/contact/index.js index de8a12b9..8b4df65c 100644 --- a/test/cases/multiple-entries-async/routes/contact/index.js +++ b/test/cases/multiple-entries-async/routes/contact/index.js @@ -1 +1,5 @@ require('./styles.txt'); + +modules.export = function() { + return 'Route Contact'; +}; diff --git a/test/cases/multiple-entries-async/routes/homepage/index.js b/test/cases/multiple-entries-async/routes/homepage/index.js index de8a12b9..336a0244 100644 --- a/test/cases/multiple-entries-async/routes/homepage/index.js +++ b/test/cases/multiple-entries-async/routes/homepage/index.js @@ -1 +1,5 @@ require('./styles.txt'); + +modules.export = function() { + return 'Route Homepage'; +};