After upgrading to 2.1 it seems like Vue registered components are completely ignored outputing errors like "Property or method "xxx" is not defined on the instance but referenced during render". Registration is done by requiring .vue files like below from within app.js
Vue.component('login', require('./pages/Login.vue'))
Login.vue
<script>
export default {
data() {
return {
model: {
identity: '',
password: '',
remember: false,
},
};
}
};
</script>
When registered inline it works
Vue.component('login', {
data() {
return {
model: {
identity: '',
password: '',
remember: false,
},
};
}
})
Reverting to version 2.0 it works again.
Here is the workaround
Vue.component('login', require('./pages/Login.vue').default)
Something is wrong in vue-loader configs.
@ruchern
Any way to restore old behaviour ?
How to return default by default?
https://github.com/vuejs/vue-loader/releases
I am looking through this release to see what are the breaking changes.
One of the breaking changes
esModules option has been removed. Built module is now always exposed as an ES module.
I think we can not restore it
https://github.com/vuejs/vue-loader/blob/master/docs/en/options.md#esmodule
I think OP got to try using the ES6 import method
import Foo from '@/components/Foo`
Vue.component('foo', Foo)
Laravel mix need to remove this old config then
https://github.com/JeffreyWay/laravel-mix/blob/master/src/config.js#L107
And force everyone to go to ES6 modules.
/cc @JeffreyWay
Ugh, I can鈥檛 force a breaking change like that for this release. We鈥檒l have to wait for a major release.
Can someone submit a PR that changes the vue-loader requirement back to what it was before?
@JeffreyWay I can submit a PR for that, but I will have to do it on the weekends where I have some spare time for myself as per discussed in #1526
Most helpful comment
/cc @JeffreyWay