Skip to content

Commit

Permalink
Merge pull request #1 from HiDeoo/webpack4
Browse files Browse the repository at this point in the history
Webpack 4 deprecation warning
  • Loading branch information
GeKorm authored Feb 26, 2018
2 parents a098602 + b978b18 commit f07847c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function PermissionsOutputPlugin(options) {
}

PermissionsOutputPlugin.prototype.apply = function (compiler) {
compiler.plugin('done', () => {
const changeFilePermissions = () => {
if (this.options.buildFolders) {
for (const dir of this.options.buildFolders) {
const dirs = FileHound.create()
Expand All @@ -31,7 +31,15 @@ PermissionsOutputPlugin.prototype.apply = function (compiler) {
fs.chmodSync(file.path || file, file.fileMode || 755);
}
}
});
}

const webpackTap = compiler.hooks && compiler.hooks.done && compiler.hooks.done.tap.bind(compiler.hooks.done);

if (webpackTap) {
webpackTap('WebpackPermissionsPlugin', changeFilePermissions);
} else {
compiler.plugin('done', changeFilePermissions);
}
};

module.exports = PermissionsOutputPlugin;

0 comments on commit f07847c

Please sign in to comment.