Skip to content
This repository was archived by the owner on Dec 5, 2019. It is now read-only.
This repository was archived by the owner on Dec 5, 2019. It is now read-only.

[Feature Request] Allow cacheKey customization #303

Closed
@Rohit-L

Description

@Rohit-L

Hello all,

Would it be possible to add an option to allow us to customize the cacheKey when caching?

Currently, this is the predefined cacheKey that is used.

            if (this.options.cache) {
              task.cacheKey = serialize({
                'uglify-es': versions.uglify,
                'uglifyjs-webpack-plugin': versions.plugin,
                'uglifyjs-webpack-plugin-options': this.options,
                path: compiler.outputPath ? `${compiler.outputPath}/${file}` : file,
                hash: crypto.createHash('md4').update(input).digest('hex'),
              });
            }

My use case is that on my production build machine, I will clone my repo into a temporary folder. The name of the temp folder is the git hash. My goal is to have the uglify cache reside outside this temp folder (which is doable as the cache option takes a string which is the cache directory).

My issue is that the cache doesn't help in this case as the cacheKey takes compiler.outputPath into consideration (the output path contains my temp folder name). Therefore, nothing will hit in the cache.

An option to allow me to customize the cacheKey that is used would let me define it so that compiler.outputPath is not used in the cacheKey.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions