-
Notifications
You must be signed in to change notification settings - Fork 63
Conversation
This breaks Node 4 compat. |
I can't remove Node 4 support for this. Is there a way to support both APIs? |
Hum I understand... maybe by detecting if |
Added compatibility with Webpack 3 (and 2, it seems to work...) |
src/index.js
Outdated
/* Webpack >= 4 */ | ||
if (compiler.hooks) { | ||
compiler.hooks.normalModuleFactory.tap('normal-module-factory', (nmf) => { | ||
nmf.hooks.afterResolve.tapAsync('after-resolve', afterResolveFn) |
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.
Instead of normal-module-factory
and after-resolve
you should pass LodashModuleReplacementPlugin
. By doing this, the ProfilingPlugin
will accurately show where the time is spent.
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.
In webpack 4, you can use synchronous callbacks for async hooks:
nmf.hooks.afterResolve.tap('LodashModuleReplacementPlugin', data => {
if (data) {
data.resource = resolve(data)
}
return data
})
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.
Thanks for the tips :)
Could we have this PR accepted, please? |
Thank you, but how about releasing/publishing a new version now? |
* Fix Tapable 1.0.0 deprecation. * Restrict to node >= 6.11.5 and remove Node 4 build * Fix Webpack < 4 compatibility and improve Travis config * Use tap instead of tapAsync for afterResolve async hook
Avoid deprecation warning with Webpack 4:
(node:6257) DeprecationWarning: Tapable.plugin is deprecated. Use new API on
.hooksinstead