You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 7, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 7, 2026. It is now read-only.
[Feature] keeping original whole or partial stats #35
We have cordova hooks in our source folder (see the cordova hooks guide for more info: https://cordova.apache.org/docs/en/dev/guide/appdev/hooks/) that need to be copied into our destination folder and need to preserve the executable bit on their file mode (i.e. ls -l should print -rwxr-xr-x for these files).
Currently this doesn't happen, but it seems like it should be easy to do by passing a options object as a 3rd parameter to the to the fs.writeFileAsync() call in the writeFilePromises with the stat.mode from the fs.statAsync() call.
The difficulty is in how we copy the files. By default, we add the files by adding them to compilation.assets and letting webpack take care of writing the files. The only time we write files with fs.writeFileAsync() is when a devServer is used (due to limitations of the server).
It's possible that this feature could piggyback on the additions needed for #15. That feature also requires fs.writeFileAsync for every file.
changed the title [-]Plugin is not copying file modes with execute permissions[/-][+][Bug] Plugin is not copying file modes with execute permissions[/+]on Oct 5, 2017
@evilebottnawi This issue is a bug on linux and macOS, ie 2 out of 3 major operating systems. It would be nice if you recognized @michael-ciniawsky 's tags and this issue's importance. Node can't spawn()/exec()/etc a copied file while this bug exists.
Reacted by Stephen Weatherford, Robert Palmer and Xavier Li
changed the title [-][Bug] Plugin is not copying file modes with execute permissions[/-][+][Feature] Plugin is not copying file modes with execute permissions[/+]on Feb 15, 2019
It executes during the 'done' phase in the webpack lifecycle.
@socialcode-rob1 How did you get the two to work in tandem? I've tried the webpack-permissions-plugin but it always seems to fire before the copy-webpack-plugin. I'm trying to get the webpack-permissions-plugin to fire after the copy-webpack-plugin has run such that the permissions are updated on the target files.
Activity
jskrzypek commentedon Apr 19, 2016
I'm trying to implement this on my fork, but it doesn't seem to be working.
I'm happy to make the PR but I need a bit of guidance.
kevlened commentedon Apr 28, 2016
The difficulty is in how we copy the files. By default, we add the files by adding them to
compilation.assetsand letting webpack take care of writing the files. The only time we write files withfs.writeFileAsync()is when adevServeris used (due to limitations of the server).It's possible that this feature could piggyback on the additions needed for #15. That feature also requires
fs.writeFileAsyncfor every file.[-]Plugin is not copying file modes with execute permissions[/-][+][Bug] Plugin is not copying file modes with execute permissions[/+]davepuchyr commentedon Nov 28, 2017
@evilebottnawi This issue is a bug on linux and macOS, ie 2 out of 3 major operating systems. It would be nice if you recognized @michael-ciniawsky 's tags and this issue's importance. Node can't spawn()/exec()/etc a copied file while this bug exists.
2 remaining items
michael-ciniawsky commentedon Nov 28, 2017
Maybe something in the direction of #119 would be sufficient enough/in the meantime
socialcode-rob1 commentedon Dec 5, 2017
To work around the issue, I've implemented this plugin https://github.com/GeKorm/webpack-permissions-plugin
It executes during the 'done' phase in the webpack lifecycle.
[-][Bug] Plugin is not copying file modes with execute permissions[/-][+][Feature] Plugin is not copying file modes with execute permissions[/+][-][Feature] Plugin is not copying file modes with execute permissions[/-][+][Feature] Copy file permissions[/+]marco-a commentedon May 18, 2019
Please make this happen. Great plugin but a pain in the ass to set the permissions afterwards ...
[-][Feature] Copy file permissions[/-][+][Feature] keeping original stats[/+][-][Feature] keeping original stats[/-][+][Feature] keeping original stats ()[/+][-][Feature] keeping original stats ()[/-][+][Feature] keeping original stats or partials[/+][-][Feature] keeping original stats or partials[/-][+][Feature] keeping original whole stats or partial[/+][-][Feature] keeping original whole stats or partial[/-][+][Feature] keeping original whole or partial stats[/+]benze commentedon Oct 1, 2020
@socialcode-rob1 How did you get the two to work in tandem? I've tried the
webpack-permissions-pluginbut it always seems to fire before thecopy-webpack-plugin. I'm trying to get thewebpack-permissions-pluginto fire after thecopy-webpack-pluginhas run such that the permissions are updated on the target files.ianpogi5 commentedon Feb 19, 2021
Should this not be the default behavior of any copy functionality?
matthewlamperski commentedon Jan 28, 2023
If anyone is still having this issue, like I was. I was able to create a very small plugin like this:
This will fire after all assets are copied over, and is working well for me. You also have to add it into your plugins like so:
Michsior14 commentedon Oct 1, 2025
Late to the party, but as a workaround I've also created the plugin that should work on any file system that provides
chmod(both fs and memfs do).https://github.com/Michsior14/permissions-webpack-plugin