egoist/vue-router-prefetch

You need to call Vue.use(VueRouter) before this plugin!

octoxan opened this issue · 5 comments

import Vue from 'vue';
import router from './routes';
import store from "./store";
import VueRouter from 'vue-router';

Vue.use(VueRouter);

import RouterPrefetch from 'vue-router-prefetch';
Vue.use(RouterPrefetch);

This throws the error You need to call Vue.use(VueRouter) before this plugin!

__WEBPACK_IMPORTED_MODULE_0_vue___default.a.use(__WEBPACK_IMPORTED_MODULE_7_vue_router__["a" /* default */]);
__WEBPACK_IMPORTED_MODULE_0_vue___default.a.use(__WEBPACK_IMPORTED_MODULE_8_vue_router_prefetch__["a" /* default */]);

I see it compiled out to this

Please create a repro on codesandbox.io and paste it here

Please create a repro on codesandbox.io and paste it here

https://codesandbox.io/s/n445jmw8np

This throws a different error though. Is that importing it wrong?

hmm maybe a codesandbox bug, tried it on stackblitz and it's working fine https://stackblitz.com/edit/js-c7khqh

Fixed in 1.1.2