"Keep times" option #435
"Keep times" option #435
Conversation
|
@akx Do you still need this feature? I can write full roadmap for correct implementation |
Sure. This implementation seems to work though, it's just the npm audit snafus keeping it back. What's wrong with the implementation in your opinion? |
|
@akx sorry, for delay, it should be solved on webpack side:
In the future, it will also allow other plugins modify stats |
|
@evilebottnawi So... that means changes to both If I rebase this PR, would it be approved until |
|
We can't implement it on plugin side, we use We already had a discussion about this, and it was decided that the implementation on webpack-sources side it the best solution. Why we still haven’t done it? Because this is a rare request. No need to be afraid to improve something. |
We're only modifying filesystem metadata that Webpack doesn't care about. That sounds like it should be safe.
The PR is aware of this and does a best effort to keep times: https://github.com/webpack-contrib/copy-webpack-plugin/pull/435/files#diff-2e0f2c5a9d0afaccd39535254a1c9076R1-R20 |
|
This implementation unsafe and potential break webpack-dev-server, solution is above |
|
I guess I'll just close this... |
This PR contains a:
Motivation / Use-Case
This adds the "keep file times" functionality discussed in #396.
Breaking Changes
This functionality is opt-in, so nothing should break (except maybe if this plugin is used in a web context without a shim for
fs, see below).Additional Info
The code in
updateTimesis a little finicky since we need to find an implementation ofutimesto use. When run in a web context (or with an output file system we don't support), turningkeepTimeson will just result in a bunch of warnings.According to webpack/webpack@e9c0d06 the default output filesystem in the forthcoming Webpack 5 will just be
graceful-fs, which hasutimesnatively. If the output filesystem object hasutimes, we expect it to be a function that smells likefs.utimes(). (This will work for any custom filesystem object too.)For Webpack 4, however, the default output file system in Webpack 4 is a custom
NodeOutputFileSystemwhich lacksutimesaltogether. However, since it is a simple wrapper aroundfs, we can assume thatfs.utimes()works fine for assets output with it.