diff --git a/tasks/partial_bundle.js b/tasks/partial_bundle.js index 083ccce5a7c..9fc64ae0ada 100644 --- a/tasks/partial_bundle.js +++ b/tasks/partial_bundle.js @@ -34,13 +34,11 @@ module.exports = function partialBundle(tasks, opts) { excludes.forEach(function(t) { var WHITESPACE_BEFORE = '\\s*'; // remove require - var newCode = partialIndex.replace( - new RegExp( - WHITESPACE_BEFORE + - 'require\\(\'\\./' + t + '\'\\),' + '|' + - 'require\\(\'\\.\\./src/traces/' + t + '/strict\'\\),', - 'g'), '' - ); + const regEx = (strict) ? + WHITESPACE_BEFORE + 'require\\(\'\\.\\./src/traces/' + t + '/strict\'\\),' : + WHITESPACE_BEFORE + 'require\\(\'\\./' + t + '\'\\),'; + + var newCode = partialIndex.replace(new RegExp(regEx, 'g'), ''); // test removal if(newCode === partialIndex) {