Skip to content

when mismatch version, it is better to fail the loader and webpack show error code #702

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

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/template-compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down