Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Commit

Permalink
fixed breaking change for MultiCompiler support
Browse files Browse the repository at this point in the history
  • Loading branch information
hulkish committed Jul 8, 2017
1 parent f1856b0 commit 3a8ce1f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ class UglifyJsPlugin {
}

apply(compiler) {
const requestShortener = new RequestShortener(compiler.context);
if (UglifyJsPlugin.appliedCompilers.has(compiler)) return;
UglifyJsPlugin.appliedCompilers.add(compiler);

const requestShortener = new RequestShortener(compiler.context || process.cwd());
// Copy uglify options
const uglifyOptions = UglifyJsPlugin.buildDefaultUglifyOptions(this.uglifyOptions);
// Making sure output options exists if there is an extractComments options
Expand Down Expand Up @@ -280,4 +283,11 @@ class UglifyJsPlugin {
}
}

Object.defineProperty(UglifyJsPlugin, 'appliedCompilers', {
enumerable: false,
configurable: false,
writable: false,
value: new WeakSet(),
});

export default UglifyJsPlugin;

0 comments on commit 3a8ce1f

Please sign in to comment.