-
-
Notifications
You must be signed in to change notification settings - Fork 179
fix(index): tapable
deprecation warnings (webpack >= v4.0.0
)
#238
Conversation
I tested this changes in Size Limit branch and everything works. |
The diff is a little bit tricky. I just move logic to functions and make |
webpack >= v4.0.0
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ai Thx
src/index.js
Outdated
}; | ||
|
||
if (compiler.hooks) { | ||
const name = 'uglifyjs-webpack-plugin'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- const name = 'uglifyjs-webpack-plugin';
+ const plugin = { name: 'UglifyJSPlugin' };
// ...hook.tap(plugin, cb)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'\n'
src/index.js
Outdated
compiler.hooks.compilation.tap(name, (compilation) => { | ||
if (this.options.sourceMap) { | ||
compilation.hooks.buildMobule.tap(name, buildMobuleFn); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'\n'
compiler.plugin('compilation', (compilation) => { | ||
if (this.options.sourceMap) { | ||
compilation.plugin('build-module', buildMobuleFn); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'\n'
@michael-ciniawsky |
webpack >= v4.0.0
)tapable
deprecation warnings (webpack >= v4.0.0
)
Released in |
Thanks to be sooooo fast 😺 |
For sure, these annoying warnings... 😛 |
Right now the plugin shows this warning when I try to run it with webpack 4.0.0-beta2:
This fix will support both webpack 3 and webpack 4 APIs without any warning. This way to deal with the API is recommended by @sokra webpack-contrib/webpack-bundle-analyzer#154 (comment)
I need this PR to add
.mjs
support to Size Limit ai/size-limit#42@michael-ciniawsky nice to see you here, you do a lot of work =^_^=