Skip to content
This repository has been archived by the owner on Mar 16, 2020. It is now read-only.

Commit

Permalink
chore(index): clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanclark committed Mar 8, 2018
1 parent 57271de commit 527db3e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ function optimizeChunkAssets(compilation, options, chunks) {
});
}

function compilationFn(compilation, plugin) {
const { options } = plugin;
function compilationFn(compilation) {
const { options, plugin } = this;

if (compilation.hooks) {
compilation
Expand Down Expand Up @@ -112,16 +112,17 @@ export default class BabelMinifyPlugin {

apply(compiler) {
const { options } = this;

// if sourcemap is not set
options.sourceMap = getDefault(options.sourceMap, !!compiler.options.devtool);

const boundCompilationFn = compilationFn.bind(this);

if (compiler.hooks) {
const { compilation } = compiler.hooks;

compilation.tap(this.plugin, compilation => compilationFn(compilation, this));
compilation.tap(this.plugin, boundCompilationFn);
} else {
compiler.plugin('compilation', compilation => compilationFn(compilation, this));
compiler.plugin('compilation', boundCompilationFn);
}
}
}
Expand Down

0 comments on commit 527db3e

Please sign in to comment.