GeKorm / webpack-permissions-plugin

A webpack plugin to manage the permissions of output files and directories
MIT License
11 stars 8 forks source link

Webpack 4 deprecation warning #1

Closed HiDeoo closed 6 years ago

HiDeoo commented 6 years ago

The plugin works out-of-the-box with Webpack 4 but due to some changes in the Webpack plugin system, it causes some deprecation warning like:

DeprecationWarning: Tapable.plugin is deprecated. Use new API on .hooks instead

According to the Webpack 4 migration guide for plugins/loaders:

The plugin method on tapable objects is theoretically backward-compatible, but it causes a deprecation warning, so plugins should consider switching to tap instead.

This pull request changes the old compiler.plugin call to the new compiler.hooks.done syntax using tap. It also add a name to the function attached to the hook as it's now used by the ProfilingPlugin, ProgressPlugin, etc.

GeKorm commented 6 years ago

Hi, thanks for the PR! I'll merge and release a new version in a few hours.

GeKorm commented 6 years ago

Hey @HiDeoo apologies for the spam, I tried to make this backward compatible, can you take a look please? I tested with webpack 3 but can't test 4 right now.

HiDeoo commented 6 years ago

No problem, great call on keeping backward compatibility.

Doesn't work as-is with Webpack 4 so I made a little change to avoid running into issues like:

TypeError: Cannot read property '_runRegisterInterceptors' of undefined

Which is basically options = this._runRegisterInterceptors(options); with this used in the tap method in the Hook class.

It don't think this should impact Webpack 3.