Skip to content

enable disable webpack cache in loaders #303

Description

@GrapevineLin

Describe the feature

Some plugins cannot work with Webpack 5's persistent cache and require it to be disabled. What are the potential solutions to this issue?

can we just do this in tramsform(same to load):

export default async function transform(this: LoaderContext<{ unpluginName: string }>, source: string, map: any) {
  const callback = this.async()
+ // add this line to disable cache in specific situations
+  this.cacheable(false)
  let unpluginName: string
  ...

or just passing some options to the loader like this:

// transform hook
    if (plugin.transform) {
      const useLoader: RuleSetUseItem[] = [{
        loader: `${TRANSFORM_LOADER}?unpluginName=${encodeURIComponent(plugin.name)}&cache[type]=memory`,
      }]

Additional information

  • Would you be willing to help implement this feature?

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