Skip to content
This repository was archived by the owner on Oct 27, 2020. It is now read-only.
This repository was archived by the owner on Oct 27, 2020. It is now read-only.

Hard to set custom cacheIdentifier that uses cache-loader version number #30

Description

@jochakovsky

The default value for cacheIdentifier is cache-loader:{version} {process.env.NODE_ENV}. My project has multiple webpack config files where the step that uses cache-loader gets the same input from previous loaders but performs different transformations (eg. Istanbul instrumentation for test builds only).

I like that the default string includes the cache-loader version number, since it makes sense to invalidate the cache when this loader is updated. When setting a custom value, it is difficult to replicate this behavior since retrieving the cache-loader version number is tricky. It seems like the best options are hard-coding the version number into the string and hoping to remember to update it when upgrading to a new version of cache-loader, or some hacky manipulation of the path returned by require.resolve("cache-loader").

Couple of possible fixes:

  1. Append the user-provided cacheIdentifier to the default string instead of replacing the default string
  2. Export the cache-loader version number

Happy to submit a PR with whatever fix is deemed best!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions