Add path to resolved vue package to vue-template-compiler's "version mismatch" error #9734
Description
What problem does this feature solve?
I was recently attempting to build docs via the documentation
package, which has the vue-template-compiler
package as a dependency. I ran into an issue where the build was failing because vue-template-compiler
was throwing a "Vue packages version mismatch" error.
I did not have vue installed globally or in the node_modules/
of my project's root directory, and it took me a while to figure out how the package was determining the version of vue and where it was resolving on my machine (I had accidentally installed an npm project in a parent directory creating a node_modules/
folder with the vue package in it).
It would be helpful, when the vue-template-compiler
throws the "version mismatch" error, to display the path the to vue
package that has been resolved. That way, it would be immediately clear which specific vue
package on the dev's machine the compiler is comparing its version to.
In the Vue Forum discussion, I asked Linus Borg if he thought a pull request to add this feature would be helpful, and he said it might be. I have created a fork and updated the error message on that forked repo. I'm submitting this feature request to be approved before making the pull request. I also am not sure how to write a unit test for the build error messaging and would appreciate guidance.
What does the proposed API look like?
Updated error message looks like this:
Vue packages version mismatch:
- vue@2.5.22
- vue-template-compiler@2.6.8
Path to vue package: /Users/brianmcmillen/tests/docs-test/node_modules/vue/dist/vue.runtime.common.js
This may cause things to work incorrectly. Make sure to use the same version for both.
If you are using vue-loader@>=10.0, simply update vue-template-compiler.
If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.