Skip to content

Commit

Permalink
Drop support for Webpack v3
Browse files Browse the repository at this point in the history
Removes backward compatibility with deprecated Tapable.plugin
interface. Now requires Tabable.hooks interface and thus you will need
to be running Webpack 4.

BREAKING CHANGE
  • Loading branch information
brandondoran committed Oct 7, 2020
1 parent 6352aa7 commit 38bcdda
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
"request": "^2.88.0",
"verror": "^1.6.1"
},
"peerDependencies": {
"webpack": "^4.0.0"
},
"lint-staged": {
"*.js": [
"eslint --cache --fix"
Expand Down
9 changes: 1 addition & 8 deletions src/RollbarSourceMapPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,7 @@ class RollbarSourceMapPlugin {
}

apply(compiler) {
if (compiler.hooks) {
compiler.hooks.afterEmit.tapAsync(
'after-emit',
this.afterEmit.bind(this)
);
} else {
compiler.plugin('after-emit', this.afterEmit.bind(this));
}
compiler.hooks.afterEmit.tapAsync('after-emit', this.afterEmit.bind(this));
}

getAssets(compilation) {
Expand Down
10 changes: 0 additions & 10 deletions test/RollbarSourceMapPlugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,6 @@ describe('RollbarSourceMapPlugin', () => {
expect.any(Function)
);
});

it('plugs into `after-emit" when "hooks" is undefined', () => {
delete compiler.hooks;
plugin.apply(compiler);
expect(compiler.plugin).toHaveBeenCalledTimes(1);
expect(compiler.plugin).toHaveBeenCalledWith(
'after-emit',
expect.any(Function)
);
});
});

describe('afterEmit', () => {
Expand Down

0 comments on commit 38bcdda

Please sign in to comment.