Skip to content

Commit

Permalink
fix(loader): skip calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
BowlingX committed Jun 16, 2017
1 parent df8986b commit b61184b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,14 @@ ExtractTextPlugin.prototype.apply = function(compiler) {
var asset = compilation.assets[name];

if (/\.js$/.test(name) && asset._source) {
var newName = name.replace(/\.js/, '.no_css.js');
var newAsset = new CachedSource(asset._source);
var regex = /\/\*__START_CSS__\*\/[\s\S]*?\/\*__END_CSS__\*\//g
var source = asset.source();

if (!source.match(regex)) {
return;
}
var newName = name.replace(/\.js/, '.no_css.js');
var newAsset = new CachedSource(asset._source);
// remove js that adds css to DOM via style-loader, so that React Loadable
// can serve smaller files (without css) in initial request.
newAsset._cachedSource = source.replace(regex, '');
Expand Down

0 comments on commit b61184b

Please sign in to comment.