I'm trying to get vue-router to work without success and it got me quite angry after a while since i don't see any issue.
I'm using webpack via Elixir in Laravel, which has gulpfile like this:
const elixir = require('laravel-elixir');
require('laravel-elixir-vue');
elixir(mix => {
mix.sass('app.scss')
.webpack('app.js');
});
Into my app.js file I'm "compiling" following code
window.Vue = require('vue');
var VueResource = require('vue-resource');
var VueRouter = require('vue-router');
Vue.use(VueResource);
Vue.use(VueRouter);
And when I call in browser console
new VueRouter({})
I got an error saying VueRouter is undefined. Why? The vue-resource is even in the app.js.
My package.json looks like this:
{
"private": true,
"scripts": {
"prod": "gulp --production",
"dev": "gulp watch"
},
"devDependencies": {
"bootstrap-sass": "^3.3.7",
"foundation-sites": "^6.2.3",
"gulp": "^3.9.1",
"jquery": "^2.2.4",
"laravel-elixir": "^6.0.0-9",
"laravel-elixir-vue": "^0.1.4",
"laravel-elixir-webpack-official": "^1.0.2",
"lodash": "^4.14.0",
"script-loader": "^0.7.0",
"vue": "^2.0.1",
"vue-resource": "^0.9.3",
"vue-router": "^2.0.0"
}
}
Can anyone help?