diff --git a/lib/template-compiler.js b/lib/template-compiler.js index b9d0d92e3..cd269ba91 100644 --- a/lib/template-compiler.js +++ b/lib/template-compiler.js @@ -59,6 +59,20 @@ module.exports = function (html) { ) } + // when vue and vue-template-compiler mismatch version, then fail the vue-loader + var vueTemplateCompiler = require('vue-template-compiler/package.json') + var vueVersion = require('vue/package.json').version + if (vueVersion !== vueTemplateCompiler.version) { + this.emitError(`\n + Vue packages version mismatch: + -vue@${vueVersion} + -${vueTemplateCompiler.name}@${vueTemplateCompiler.version} + 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 ${vueTemplateCompiler.name}. + If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump ${vueTemplateCompiler.version} to the latest.\n + `) + } + var compiled = compiler.compile(html, Object.assign({ preserveWhitespace: options.preserveWhitespace }, defaultCompileOptions))