diff --git a/packages/vue-router/README.md b/packages/vue-router/README.md index 181e77e05..b05694c7b 100644 --- a/packages/vue-router/README.md +++ b/packages/vue-router/README.md @@ -9,8 +9,10 @@ import BugsnagPerformance from '@bugsnag/browser-performance' import { VueRouterRoutingProvider } from '@bugsnag/vue-router-performance' import { createRouter, createWebHistory } from 'vue-router' +const base = 'my-app + const router = createRouter({ - history: createWebHistory('vue-router'), + history: createWebHistory(base), routes: [ { path: '/', @@ -20,16 +22,15 @@ const router = createRouter({ { path: '/contacts/:contactId', name: 'contact', - component: () => import('../views/ContactView.vue') + component: () => import('./views/ContactView.vue') } ] }) -const basename = '/vue-router' BugsnagPerformance.start({ apiKey, - routingProvider: new VueRouterRoutingProvider(router, basename) + routingProvider: new VueRouterRoutingProvider(router, base) }) const app = createApp(App) diff --git a/test/browser/features/fixtures/packages/vue-router/src/main.js b/test/browser/features/fixtures/packages/vue-router/src/main.js index 2324bfc99..f990184f8 100644 --- a/test/browser/features/fixtures/packages/vue-router/src/main.js +++ b/test/browser/features/fixtures/packages/vue-router/src/main.js @@ -1,4 +1,6 @@ import { createApp } from 'vue' +import { createRouter, createWebHistory } from 'vue-router' +import HomeView from './views/HomeView.vue' import App from './App.vue' import router from './router' import BugsnagPerformance from '@bugsnag/browser-performance' @@ -8,7 +10,24 @@ const parameters = new URLSearchParams(window.location.search) const apiKey = parameters.get('api_key') const endpoint = parameters.get('endpoint') -const basename = '/vue-router' +const base = '/vue-router' + +const router = createRouter({ + history: createWebHistory(base), + routes: [ + { + path: '/', + name: 'home', + component: HomeView + }, + { + path: '/contacts/:contactId', + name: 'contact', + component: () => import('./views/ContactView.vue') + } + ] +}) + BugsnagPerformance.start({ apiKey, @@ -16,7 +35,7 @@ BugsnagPerformance.start({ maximumBatchSize: 13, batchInactivityTimeoutMs: 5000, autoInstrumentNetworkRequests: false, - routingProvider: new VueRouterRoutingProvider(router, basename) + routingProvider: new VueRouterRoutingProvider(router, base) }) const app = createApp(App) diff --git a/test/browser/features/fixtures/packages/vue-router/src/router/index.js b/test/browser/features/fixtures/packages/vue-router/src/router/index.js deleted file mode 100644 index 0d6d7c7df..000000000 --- a/test/browser/features/fixtures/packages/vue-router/src/router/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import { createRouter, createWebHistory } from 'vue-router' -import HomeView from '../views/HomeView.vue' - -const router = createRouter({ - history: createWebHistory('vue-router'), - routes: [ - { - path: '/', - name: 'home', - component: HomeView - }, - { - path: '/contacts/:contactId', - name: 'contact', - component: () => import('../views/ContactView.vue') - } - ] -}) - -export default router