-
Notifications
You must be signed in to change notification settings - Fork 918
[Bug]All vue-loader rule configs adopt the first vue-loader rule options #1614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
vue-loader现在还不支持多个rule的配置 |
thank you for chinese answer in english forum, good job |
When you use "webpack v5.0.0", if you encounter "error error: [vueloaderplugin error] no matching use for Vue loader is found. Make sure the rule matching. Vue files include Vue loader in its", If other loaders appear before "Vue loader", for example, "HTML loader" appears before "Vue loader", then just add an "enforce" option in the rules of "HTML loader", and its value is the string "post". In this way, the original loader can be used normally without changing the order of the original loader. module: { // first loader // other loader... { ], |
Today, while updating the configuration of webpack 5, I explored this problem and verified that this method is ok. |
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 theoptions
will not, all the vue files will be applied with the first vue-loaderoptions
.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 filenamefoo.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 theoptions
, 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
The text was updated successfully, but these errors were encountered: