Skip to content

Commit

Permalink
Reset the outputNormal object to avoid duplicate files
Browse files Browse the repository at this point in the history
  • Loading branch information
chihsuan committed Feb 27, 2024
1 parent 8d29407 commit 5591fcb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/woocommerce-admin/unminify.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* 2. Remove check for development mode - we always want unminified files.
* 3. Remove BannerPlugin support - we don't use it.
* 4. Remove the 'min' suffix from the chunk loaded in the new `mainEntry` option.
* 5. Hook into compilation later so we're running after Source Map generation. (https://webpack.js.org/api/compilation-hooks/: PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE)
* 5. Hook into compilation later so we're running after Source Map generation. (https://webpack.js.org/api/compilation-hooks/: PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE)
*/
const path = require( 'path' );
const ModuleFilenameHelpers = require( 'webpack/lib/ModuleFilenameHelpers' );
Expand Down Expand Up @@ -39,7 +39,7 @@ class UnminifyWebpackPlugin {

apply( compiler ) {
const options = this.options;
const outputNormal = {};
let outputNormal = {};

compiler.hooks.compilation.tap(
'UnminifyWebpackPlugin',
Expand Down Expand Up @@ -107,6 +107,8 @@ class UnminifyWebpackPlugin {
value.filename,
new webpack.sources.RawSource( value.content )
);
// Reset the outputNormal object to avoid writing to file that only differs in casing or query string from already written file.
outputNormal = {};
}
}
);
Expand Down

0 comments on commit 5591fcb

Please sign in to comment.