Skip to content

[Bug]All vue-loader rule configs adopt the first vue-loader rule options #1614

Open
@NE-SmallTown

Description

@NE-SmallTown

Version

15.7.2

Reproduction link

https://github.com/NE-SmallTown/vue-compiler-options-bug-repro

Steps to reproduce

Just clone the repro repo and run yarn run start.

As mentioned at this comment, when we config more than one vue-loader, the first options will be adopted by all vue-loader.

Due to the resourceQuery check, the include/exclude options of webpack rule will works, but the options will not, all the vue files will be applied with the first vue-loader options.

The key problem here is not that we use findIndex(so we will always get the first vue-loader options), but because there is no way to get the real options based on the resource, VueLoaderPlugin is a plugin, not a loader. So I guess that's why we pass a fake filename foo.vue rather than a real filename.

Since we can't get the real filename/resource in a plugin(that's how plugin works and no problem), and in a plugin there is no such hook/method like resourceQuery to choose whether or not apply the options, so I think it's hard for me to fix this bug, but maybe just because I'm not familiar with webpack.

BTW, I notice that seems we use the ident "vue-loader-options" to mark the options which would be used by a vue-loader/template-loader? But I don't figure out how to make it rely on its own options rather than the first loader options.

What is expected?

The options will be adopted based on the include/exclude option

What is actually happening?

The first options are adopted for all vue-loader Rule config

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