Skip to content

VueLoaderPlugin can try to mutate shared rules array twice / spurious "No matching use for vue-loader is found." when rules array shared #1286

Closed
@frankier

Description

@frankier

Version

15.0.0

Reproduction link

https://jsbin.com/kexokimalo/edit?js

Steps to reproduce

  1. Have a webpack configuration with multiple entry points
  2. Share the rule array between multiple entry points, each using the VueLoaderPlugin()

What is expected?

Webpack compiles things

What is actually happening?

An error message

Error: [VueLoaderPlugin Error] No matching use for vue-loader is found.
Make sure the rule matching .vue files include vue-loader in its use.


The problem is that the plugin VueLoaderPlugin works off the already processed rules array which has pitcher injected into it. Now something other than the vue-loader rule will match and cause the error.

I guess one fix could involve checking whether the rules array has already been modified and bailing early if it has.

Workaround: shallow clone your rules using rules.slice(0)

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