In my webpack mix file I have set .extract(['vue',...
Then
mix.autoload({ validator: ['validator', 'window.validator'], vue: ['window.Vue', 'Vue'] });
And lastly removed any Vue refrence in app.js and bootstrap.js
But now when I try to use Vue in other js files I still get the error: Uncaught ReferenceError: Vue is not defined
So how can I exctract Vue and still use it in other files like: var app = new Vue({...
Keep your Vue settings as per factory default for Laravel-Mix, which is to leave window.Vue = require('vue') inside bootstrap.js
It worked for me and probably many others too.
Same problem here, how are you supposed to autoload vue it is really confusing, I am getting Vue undefined regardless of the approach followed
vue: ['Vue', 'window.Vue']
or
'vue/dist/vue.esm.js': ['Vue', 'window.Vue']
or
should I use provideplugin for this like
mix.webpackConfig({
plugins: [
new webpack.ProvidePlugin({
Vue: ["vue/dist/vue.esm.js", "default"]
})
]
});
I have NOT import Vue in my app.js file because I am guessing autoload will inject a global Vue component, I have a console.log(Vue.length) just to ensure that Vue is not excluded though
Should I import Vue from vue after doing autoload as well
Should I also add window.Vue = Vue
Some clarification would be really apprecaited
@slidenerd I have the same confusion as you.
Most helpful comment
Keep your Vue settings as per factory default for Laravel-Mix, which is to leave
window.Vue = require('vue')insidebootstrap.jsIt worked for me and probably many others too.