meteor-vue / vue-meteor

🌠 Vue first-class integration in Meteor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vue 2 is not working with Meteor 2.12

Grubba27 opened this issue · comments

To reproduce:

meteor create vue-test --vue-2
meteor

Gives a big error but the summary of the error is this text below:

[vue-component] Error while compiling in tag <script> using lang js: Can't find handler for lang 'js', did you install it?
[vue-component] Error while compiling in tag <script> using lang js TemplatingTools is not defined
ReferenceError: TemplatingTools is not defined
    at throwCompileError (packages/vue-component/plugin/utils.js:200:15)
    at VueComponentTagHandler.getResults (packages/vue-component/plugin/tag-handler.js:87:13)
    at compileTags (packages/vue-component/plugin/vue-compiler.js:534:18)

As I was looking in the source code I found a snippet in packages/vue-component/plugin/tag-handler.js that does look like this:

const compile = global.vue.lang[lang] // maybe here is breaking?
if (!compile) {
/// error

tried in 0.16.0 and 0.15.3, and both break. Maybe it is unrelated to the vue-components package, but I'm unsure how to look into this.

@Grubba27 we found this issue too, and on updating one of our projects.

the issue seems to be this line that was added recently to the tag handler:

if (sfcBlock.type === 'script' && !sfcBlock.lang) {
sfcBlock.lang = 'js'
}

Which then forces the builder to look for compiler with options for JS vs just skipping the whole block and using babel to transpile the JS.

If you copy the vue-component package to your local packages and uncomment this line it should start working again.

You also need to make sure you have a version of vue-template-compiler that matches your vue version installed from npm too, otherwise it will complain that the version your using doesn't match (silently if you dont have the compiler debug on). since we are using vue@2.6.12 i had to also install the vue-template-compiler@2.6.12 to make things work properly.

Not sure if thats the best way to handle the issue, but submitted a PR for the workaround that works for me.

Thank you. I've updated our project last night an am experiencing the same issue. Appreciate the work around.