From a2af66760ff09d6f2ba11470013d46a1c8edb858 Mon Sep 17 00:00:00 2001 From: Brian McMillen Date: Wed, 20 Mar 2019 01:13:14 -0400 Subject: [PATCH] polish: improve template compiler version mismatch warning (#9738) --- packages/vue-template-compiler/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/vue-template-compiler/index.js b/packages/vue-template-compiler/index.js index 287d281738e..dcc7e6cbe9c 100644 --- a/packages/vue-template-compiler/index.js +++ b/packages/vue-template-compiler/index.js @@ -5,10 +5,12 @@ try { var packageName = require('./package.json').name var packageVersion = require('./package.json').version if (vueVersion && vueVersion !== packageVersion) { + var vuePath = require.resolve('vue') + var packagePath = require.resolve('./package.json') throw new Error( '\n\nVue packages version mismatch:\n\n' + - '- vue@' + vueVersion + '\n' + - '- ' + packageName + '@' + packageVersion + '\n\n' + + '- vue@' + vueVersion + ' (' + vuePath + ')\n' + + '- ' + packageName + '@' + packageVersion + ' (' + packagePath + ')\n\n' + 'This may cause things to work incorrectly. Make sure to use the same version for both.\n' + 'If you are using vue-loader@>=10.0, simply update vue-template-compiler.\n' + 'If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump ' + packageName + ' to the latest.\n'