Closed Zubair-Iftikhar closed 3 years ago
it should be window.Vue = require('vue')
window.Vue = require('vue')
i use this statement. but same error "Uncaught TypeError: window.Vue.use is not a function"
app.js
require('./bootstrap');
window.Vue = require('vue')
require('../assets/vendor/MediaManager/js/manager')
new Vue({
el: '#app'
})
by access media route .error shown in chrome developer console..
app.js:75785 Uncaught TypeError: window.Vue.use is not a function
at Module.<anonymous> (app.js:75785)
at __nested_webpack_require_573__ (app.js:74974)
at app.js:75038
at app.js:75041
at webpackUniversalModuleDefinition (app.js:74952)
at Object../node_modules/vue2-filters/dist/vue2-filters.js (app.js:74954)
at __webpack_require__ (app.js:87947)
at Module../resources/assets/vendor/MediaManager/js/manager.js (app.js:5127)
at __webpack_require__ (app.js:87947)
at Object../resources/js/app.js (app.js:8898)
in app.js Line #75785
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(Vue2Filters);
window.Vue2Filters = Vue2Filters;
}
this line causes the error
window.Vue.use(Vue2Filters)
can u reproduce using the demo repo ?
using clone demo repo after npm run watch these error shown in cmd.
ERROR in ./resources/assets/vendor/MediaManager/js/components/utils/icon-types.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
at parse (E:\workspace\demo\media-manager\node_modules\@vue\component-compiler-utils\dist\parse.js:15:23)
at Object.module.exports (E:\workspace\demo\media-manager\node_modules\vue-loader\lib\index.js:67:22)
ERROR in ./node_modules/vuemit/src/Vuemit.js 9:12-26
Module not found: Error: Can't resolve 'vue' in 'E:\workspace\demo\media-manager\node_modules\vuemit\src'
sorry for the late replay, u r correct, after the last mix patch 6.0.9
ref things went south, i will ping u once fixed.
thank you for reporting.
Hi, I'm having the same issue using a fresh installed project (laravel-mix 6.0.6
). Is there any temporary way to fix this? Seems like the issue is not from mix patch 6.0.9
.
Is there any temporary way to fix this ?
yeah
v6.0.3
demo repo is also reverted back to 6.0.3
good news, all done except a couple of minor issues, will update once done.
the issue should be fully solved now, plz re-check and test with demo repo and reply back if the problem still persist, thanx again for ur time & reporting.
Hi, I'm having the same issue using a fresh installed project (laravel-mix
6.0.6
). Is there any temporary way to fix this? Seems like the issue is not from mix patch6.0.9
.
Hi i was having very similar issues till I realized removing Vue from the mix.autoload fixed my problem.
This what I had before and I removed vue from the autoload.
mix.autoload({
jquery: ["$", "window.jQuery"],
vue: ["window.Vue"],
lodash: ["window._", "_"],
axios: ["window.axios", "axios"]
});
Similar issues now testing Laravel Mix 6.037 . When I import Vue I am told Vue is not a constructor in vuemit
used by Laravel Media Manager. When I attach Vue to window and require I get Vue.use is not a function
referring to first Vue.use
in app.js
(editor.js
in our case and Vue Portal).
So importing like this:
require('./bootstrap');
import Vue from 'vue';
import Vuex from 'vuex'
import store from './store/editor'
/**
* Import classes and bind to window for use through the application
*/
import PortalVue from 'portal-vue';
Vue.use(PortalVue);
import Module from './classes/Module'
....
require('../assets/vendor/MediaManager/js/manager.js')
...
and app balks that Vue is not a constructor referring to manager.js loading vuemit
. And if I do require Vue.use
in app.js
dies on me.
Also see https://forum.vuejs.org/t/laravel-mix-6-webpack-5-upgrade-vue-use-is-not-a-function-portalvue/123363/11 where I am debugging in more detail and trying to solve the issue.
@jasperf actually this issue was fixed already https://github.com/gocanto/vuemit/pull/40 not sure why u r getting this now, sadly laravel-mix 6x
is f*cking things up from one release to another, if possible i would recommend to stick to whatever old version of mix was working for u
Luckily did find the solution . New Mix automatically loaded vue.esm.js
and we needed vue.common.js
. Added additional configuration block to webpack.mix.js
:
mix.webpackConfig({
resolve: {
alias: {
'vue$': 'vue/dist/vue.common.js'
}
}
})
and now it is fine. Took me a long time figuring that out though .
@jasperf thanks for this, i will add it to the wiki
app.js
npm run dev successfully compiled. http://127.0.0.1:8000/media show error in chrom developer console
package.json
composer.json